Sequential consistency imposes a global order of all atomic operations on all threads. As far as I know, this means that threads will behave as specified in the source code, with no reordering. All threads will execute their operations in a sequential order.
Intuitively, it looks like an option or a flag to set in the main()
function of your multithreaded app, something like "I want all my threads to follow sequential consistency". Of course there's no such thing in C++.
So here's my question: is the sole presence of a single x.load(std::memory_order_seq_cst)
or x.store(y, std::memory_order_seq_cst)
instruction anywhere in the code enough to force ALL threads, even those unrelated to x
to behave in a sequentially consistent way?