Atomic operations library

From Cppreference

< cpp
Jump to: navigation, search

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.

Defined in header <atomic>

Contents

Atomic types
atomic (C++11)
atomic class template and specializations for bool, integral, and pointer types
(class template)
atomic_is_lock_free (C++11)
checks if the atomic type's operations are lock-free
(function template)
Operations on atomic types
atomic_store
atomic_store_explicit
(C++11)
(C++11)
atomically replaces the value of the atomic object with a non-atomic argument
(function template)
atomic_load
atomic_load_explicit
(C++11)
(C++11)
atomically obtains the value stored in an atomic object
(function template)
atomic_exchange
atomic_exchange_explicit
(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)
atomic_compare_exchange_weak
atomic_compare_exchange_weak_explicit
atomic_compare_exchange_strong
atomic_compare_exchange_strong_explicit
(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)
atomic_fetch_add
atomic_fetch_add_explicit
(C++11)
(C++11)
adds a non-atomic value to an atomic object and obtains the previous value of the atomic
(function template)
atomic_fetch_sub
atomic_fetch_sub_explicit
(C++11)
(C++11)
subtracts a non-atomic value from an atomic object and obtains the previous value of the atomic
(function template)
atomic_fetch_and
atomic_fetch_and_explicit
(C++11)
(C++11)
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)
atomic_fetch_or
atomic_fetch_or_explicit
(C++11)
(C++11)
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)
atomic_fetch_xor
atomic_fetch_xor_explicit
(C++11)
(C++11)
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
atomic_flag (C++11)
the lock-free boolean atomic type
(class)
atomic_flag_test_and_set
atomic_flag_test_and_set_explicit
(C++11)
(C++11)
atomically sets the flag to true and returns its previous value
(function)
atomic_flag_clear
atomic_flag_clear_explicit
(C++11)
(C++11)
atomically sets the value of the flag to false
(function)
Initialization
atomic_init (C++11)
non-atomic initialization of a default-constructed atomic object
(function template)
ATOMIC_VAR_INIT (C++11)
constant initialization of an atomic variable of static storage duration
(function macro)
ATOMIC_FLAG_INIT (C++11)
initializes an std::atomic_flag to false
(macro constant)
Memory synchronization ordering
memory_order (C++11)
defines memory ordering constraints for the given atomic operation
(typedef)
kill_dependency (C++11)
removes the specified object from the std::memory_order_consume dependency tree
(function template)
atomic_thread_fence (C++11)
generic memory order-dependent fence synchronization primitive
(function)
atomic_signal_fence (C++11)
fence between a thread and a signal handler executed in the same thread
(function)