The Synchronisation and Ordering Constraints
You cannot configure the atomicity of an atomic data type, but you can accurately adjust the synchronisation and ordering constraints of atomic operations. Adjusting the synchronisation and ordering constraints is a possibility which is unique to C++ and is not possible in C#’s or Java’s memory model.
There are six different variants of the memory model in C++. The key question is what their characteristics are?
The Six Variants of Memory Orderings in C++
We already know C++ has six variants of the memory ordering. The default for atomic operations is std::memory_order_seq_cst
. This expression stands for sequential consistency. Besides, you can explicitly specify one of the other five. So what does C++ have to offer?
To...