Описание тега stdatomic

NoneStd::atomic is a class template in the C++11 Standard Library which provides atomic operations.

std::atomic is a class template in the C++11 Standard Library, defined in the <atomic> header. An atomic object of type std::atomic<X> provides member functions to perform atomic operations on its member of type X.

Like mutexes, atomic objects can be used for synchronization in multi-threaded C++ programs. Unlike mutexes or other locks, atomics can be used to build lock-free algorithms that allow concurrent readers and writers.

Atomics can even be used to build custom locking primitives (but that's usually a bad idea on systems with OS-supported locking functions that yield the CPU on contention).

Resources: