What exactly is std::atomic
C++ atomics and memory ordering
This is used to prevent the CPU from doing the instruction reordering.
An operation (or set of operations) is atomic, linearizable, indivisible or uninterruptible if it appears to the rest of the system to occur at once without being interrupted. Atomicity is a guarantee of isolation from interrupts, signals, concurrent processes and threads.