just::thread Complete C++ Standard Thread Library by Just Software Solutions

Documentation Home >> Headers >> <atomic> Header >> std::memory_order enumeration

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_relaxed

The operation does not provide any additional ordering constraints.

std::memory_order_release

The 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_acquire

The 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_rel

The operation must be a read-modify-write operation, and behaves as both std::memory_order_acquire and std::memory_order_release on the specified location.

std::memory_order_seq_cst

The 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_release operation, if it is a load it behaves like a std::memory_order_acquire operation, and if it is a read-modify-write operation then it behaves as both std::memory_order_acquire and std::memory_order_release. This is the default for all operations.

std::memory_order_consume

The operation is a consume operation on the specified memory location.

Header

#include <atomic>

See Also