Atomic operations library
The atomic library provides components for fine-grained atomic operations allowing for lockless concurrent programming. Each atomic operation is indivisible with regards to any other atomic operation that involves the same object. Atomic objects are free of data races.
Defined in header <atomic> |
|
---|---|
Atomic types |
|
(C++11) | atomic class template and specializations for bool, integral, and pointer types (class template) |
(C++20) | provides atomic operations on non-atomic objects (class template) |
Operations on atomic types |
|
(C++11) | checks if the atomic type's operations are lock-free (function template) |
(C++11)(C++11) | atomically replaces the value of the atomic object with a non-atomic argument (function template) |
(C++11)(C++11) | atomically obtains the value stored in an atomic object (function template) |
(C++11)(C++11) | atomically replaces the value of the atomic object with non-atomic argument and returns the old value of the atomic (function template) |
(C++11)(C++11)(C++11)(C++11) | atomically compares the value of the atomic object with non-atomic argument and performs atomic exchange if equal or atomic load if not (function template) |
(C++11)(C++11) | adds a non-atomic value to an atomic object and obtains the previous value of the atomic (function template) |
(C++11)(C++11) | subtracts a non-atomic value from an atomic object and obtains the previous value of the atomic (function template) |
(C++11)(C++11) | replaces the atomic object with the result of bitwise AND with a non-atomic argument and obtains the previous value of the atomic (function template) |
(C++11)(C++11) | replaces the atomic object with the result of bitwise OR with a non-atomic argument and obtains the previous value of the atomic (function template) |
(C++11)(C++11) | replaces the atomic object with the result of bitwise XOR with a non-atomic argument and obtains the previous value of the atomic (function template) |
Flag type and operations |
|
(C++11) | the lock-free boolean atomic type (class) |
(C++11)(C++11) | atomically sets the flag to true and returns its previous value (function) |
(C++11)(C++11) | atomically sets the value of the flag to false (function) |
Initialization |
|
(C++11) | non-atomic initialization of a default-constructed atomic object (function template) |
(C++11) | constant initialization of an atomic variable of static storage duration (function macro) |
(C++11) | initializes an std::atomic_flag to false (macro constant) |
Memory synchronization ordering |
|
(C++11) | defines memory ordering constraints for the given atomic operation (enum) |
(C++11) | removes the specified object from the std::memory_order_consume dependency tree (function template) |
(C++11) | generic memory order-dependent fence synchronization primitive (function) |
(C++11) | fence between a thread and a signal handler executed in the same thread (function) |
See also
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/atomic