Title
Clarify that compare_exchange is not a read-modify-write operation
Status
resolved
Section
[atomics.types.operations]
Submitter
Alisdair Meredith

Created on 2009-03-12.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [atomics.types.operations] p18:

-18- Effects: Atomically, compares the value pointed to by object or by this for equality with that in expected, and if true, replaces the value pointed to by object or by this with desired, and if false, updates the value in expected with the value pointed to by object or by this. Further, if the comparison is true, memory is affected according to the value of success, and if the comparison is false, memory is affected according to the value of failure. When only one memory_order argument is supplied, the value of success is order, and the value of failure is order except that a value of memory_order_acq_rel shall be replaced by the value memory_order_acquire and a value of memory_order_release shall be replaced by the value memory_order_relaxed. If the comparison is true, Tthese operations are atomic read-modify-write operations (1.10). If the comparison is false, these operations are atomic load operations.

Date: 2010-12-05.14:14:49

[ 2009-10 Santa Cruz: ]

NAD EditorialResolved. Addressed by N2992.

Date: 2009-08-17.00:00:00

[ 2009-08-17 Handled by N2925. ]

Date: 2010-10-21.18:28:33

[ 2009-07 post-Frankfurt: ]

This is likely to be addressed by Lawrence's upcoming paper. He will adopt the proposed resolution.

Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

We recommend the proposed resolution be reviewed by members of the Concurrency Subgroup.

Date: 2010-10-21.18:28:33

[ Summit: ]

Group agrees with the resolution as proposed by Anthony Williams in the attached note.

Date: 2010-10-21.18:28:33

[ Anthony Williams adds: ]

In [atomics.types.operations] p18 it says that "These operations are atomic read-modify-write operations" (final sentence). This is overly restrictive on the implementations of compare_exchange_weak and compare_exchange_strong on platforms without a native CAS instruction.

Date: 2012-10-21.13:19:07

Addresses US 91 [CD1]

It is unclear whether or not a failed compare_exchange is a RMW operation (as used in [intro.multithread]).

Suggested solution:

Make failing compare_exchange operations not be RMW.

History
Date User Action Args
2010-12-05 14:14:49adminsetstatus: nad editorial -> resolved
2010-10-21 18:28:33adminsetmessages: + msg463
2010-10-21 18:28:33adminsetmessages: + msg462
2010-10-21 18:28:33adminsetmessages: + msg461
2010-10-21 18:28:33adminsetmessages: + msg460
2010-10-21 18:28:33adminsetmessages: + msg459
2010-10-21 18:28:33adminsetmessages: + msg458
2010-10-21 18:28:33adminsetmessages: + msg457
2009-03-12 00:00:00admincreate