3 ms·
I appreciate that this was written by someone new to atomics and memory ordering semantics. But it presents itself as authoritative despite having some mistake
by loeg 3y ago
I appreciate that this was written by someone new to atomics and memory ordering semantics. But it presents itself as authoritative despite having some mistakes. So I am not super keen on that.
Just for example, right off the bat:
> Atomics are simply operations or instructions that cannot be split by the compiler or the CPU or re-ordered in any way.
C++ atomics can in fact be reordered by the compiler or CPU, depending on ordering semantics. Acquire loads cannot be reordered after subsequent program-order loads or stores. But they can be reordered before previous program-order operations. Similarly, release stores cannot be reordered before prior program-order operations, but can be reordered after subsequent program-order operations. Relaxed atomic operations can be reordered arbitrarily (other than with accesses to the same object).