The std::memory_order enumeration is used to specify
the ordering constraints of atomic operations.
typedef enum memory_order { memory_order_relaxed,memory_order_consume,memory_order_acquire, memory_order_release,memory_order_acq_rel,memory_order_seq_cst } memory_order;
Operations tagged with the various memory order values behave as follows:
std::memory_order_relaxedThe operation does not provide any additional ordering constraints.
std::memory_order_releaseThe operation is a release operation on the specified memory location. This therefore synchronizes-with an acquire operation on the same memory location that reads the stored value.
std::memory_order_acquireThe operation is an acquire operation on the specified memory location. If the stored value was written by a release operation, that store synchronizes-with this operation.
std::memory_order_acq_relThe operation must be a read-modify-write operation, and behaves as both
std::memory_order_acquireandstd::memory_order_releaseon the specified location.std::memory_order_seq_cstThe operation forms part of the single global total order of sequentially consistent operations. Additionally, if it is a store then it behaves like a
std::memory_order_releaseoperation, if it is a load it behaves like astd::memory_order_acquireoperation, and if it is a read-modify-write operation then it behaves as bothstd::memory_order_acquireandstd::memory_order_release. This is the default for all operations.std::memory_order_consumeThe operation is a consume operation on the specified memory location.
Header
#include <atomic>