1472. Incorrect semantics of atomic_init

Section: 32.5.8.2 [atomics.types.operations] Status: NAD Editorial Submitter: INCITS Opened: 2010-08-25 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [atomics.types.operations].

View all other issues in [atomics.types.operations].

View all issues with NAD Editorial status.

Discussion:

Addresses US-171

As of 32.5.8.2 [atomics.types.operations] p. 7:

The atomic_init definition "Non-atomically assigns the value" is not quite correct, as the atomic_init purpose is initialization.

Proposed resolution:

Change 32.5.8.2 [atomics.types.operations] p. 7 as indicated:

void atomic_init(volatile A *object, C desired);
void atomic_init(A *object, C desired);

7 Effects: Non-atomically assigns the value desired to *objectInitializes *object with value desired. Concurrent access from another thread, even via an atomic operation, constitutes a data race. [Note: This function should only be applied to objects that have been default constructed. These semantics ensure compatibility with C. — end note]