Title
weak compare-and-exchange confusion
Status
c++11
Section
[atomics.types.operations]
Submitter
INCITS

Created on 2010-08-25.00:00:00 last changed 162 months ago

Messages

Date: 2011-02-24.19:08:21

Proposed resolution:

  1. Change [atomics.types.operations.req] p. 23 as indicated:

    [ Note: For example, tThe effect of the compare-and-exchange operationsatomic_compare_exchange_strong is

    if (memcmp(object, expected, sizeof(*object)) == 0)
      memcpy(object, &desired, sizeof(*object));
    else
      memcpy(expected, object, sizeof(*object));
    

    end note ] [..]

  2. Change [atomics.types.operations.req] p. 25 as indicated:

    25 Remark: The weak compare-and-exchange operations may fail spuriously, that is, return false while leaving the contents of memory pointed to by expected before the operation is the same that same as that of the object and the same as that of expected after the operationA weak compare-and-exchange operation may fail spuriously. That is, even when the contents of memory referred to by expected and object are equal, it may return false and store back to expected the same memory contents that were originally there.. [ Note: This spurious failure enables implementation of compare-and-exchange on a broader class of machines, e.g., loadlocked store-conditional machines. A consequence of spurious failure is that nearly all uses of weak compare-and-exchange will be in a loop.

    When a compare-and-exchange is in a loop, the weak version will yield better performance on some platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the strong one is preferable. — end note ]

Date: 2011-02-24.00:00:00

[ 2011-02-24 Reflector discussion ]

Moved to Tentatively Ready after 6 votes.

Date: 2011-02-15.00:00:00

[ 2011-02-15 Howard fixes numbering, Hans improves the wording ]

Date: 2010-10-28.00:00:00

[ 2010-10-28 Daniel adds: ]

Duplicate issue 1475 also has a proposed resolution, but both issues are resolved with below proposed resolution.

Date: 2011-02-15.21:33:25

Duplicate: 1470

Duplicate: 1475

Duplicate: 1477

Addresses US-175, US-165, CH-23, GB-135

[atomics.types.operations.req] p. 25: The first sentence is grammatically incorrect.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2011-04-11 11:23:23adminsetstatus: voting -> wp
2011-03-05 15:24:28adminsetstatus: ready -> voting
2011-02-24 19:08:21adminsetmessages: + msg5537
2011-02-24 19:08:21adminsetstatus: open -> ready
2011-02-15 21:33:25adminsetmessages: + msg5489
2010-10-28 22:49:09adminsetmessages: + msg5179
2010-10-28 22:49:09adminsetmessages: + msg5178
2010-10-24 03:04:13adminsetmessages: + msg4960
2010-08-25 00:00:00admincreate