Full name of submitter (unless configured in github; will be published with the issue): Jim X
Consider this example:
std::atomic<int> v = 0; // thread 1: v.load(std::memory_order::seq_cst); //thread 2: v.store(1,std::memory_order::seq_cst);
If the load operation reads the value 0
, how are they ordered in the single total order? According to [atomics.order] p3
An atomic operation A on some atomic object M is coherence-ordered before another atomic operation B on M if
- [...]
A and B are not the same atomic read-modify-write operation, and there exists an atomic modification X of M such that A reads the value stored by X and X precedes B in the modification order of M, or
The initialization to v
is not an atomic modification as per [atomics.types.operations] p3
Effects: Initializes the object with the value desired. Initialization is not an atomic operation ([intro.multithread]).
The initialization(i.e. X
) precedes the store(i.e. B
) in the modification order of v
, however, X
is not atomic modification, so, how does p3.3 apply to this case to determine the order of the load and store in the single total order?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4