June 2018
Intermediate to advanced
348 pages
8h 45m
English
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 ...