Acquire-release ordering
Now, let's dive deep into memory-ordering semantics provided by the C++ standard library. This is the area where the programmer's intuition about ordering in multithread code begins to fade, because there is no global synchronization between threads in acquire-release semantics of atomic operations. These semantics only allow synchronization between atomic operations on the same atomic variable. To elaborate, the load operation on an atomic variable performing in one thread can be synchronized with store operation happening on the same atomic variable in some other thread. A programmer must extract this feature that establishes a happen-before relationship between atomic variables to synchronize between threads. This ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access