W3cubDocs

/C++

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)
Operations on atomic types
checks if the atomic type's operations are lock-free
(function template)
atomically replaces the value of the atomic object with a non-atomic argument
(function template)
atomically obtains the value stored in an atomic object
(function template)
atomically replaces the value of the atomic object with non-atomic argument and returns the old value of the atomic
(function template)
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)
adds a non-atomic value to an atomic object and obtains the previous value of the atomic
(function template)
subtracts a non-atomic value from an atomic object and obtains the previous value of the atomic
(function template)
replaces the atomic object with the result of logical AND with a non-atomic argument and obtains the previous value of the atomic
(function template)
replaces the atomic object with the result of logical OR with a non-atomic argument and obtains the previous value of the atomic
(function template)
replaces the atomic object with the result of logical 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)
atomically sets the flag to true and returns its previous value
(function)
atomically sets the value of the flag to false
(function)
Initialization
(C++11)
non-atomic initialization of a default-constructed atomic object
(function template)
constant initialization of an atomic variable of static storage duration
(function macro)
initializes an std::atomic_flag to false
(macro constant)
Memory synchronization ordering
(C++11)
defines memory ordering constraints for the given atomic operation
(typedef)
removes the specified object from the std::memory_order_consume dependency tree
(function template)
generic memory order-dependent fence synchronization primitive
(function)
fence between a thread and a signal handler executed in the same thread
(function)

See also

C documentation for Atomic operations library

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/atomic