Parameters

Order2
Second memory_order argument. The value of Order2 cannot be memory_order_release or memory_order_acq_rel, it cannot be stronger than the value of Order1.

Return Value

A bool that indicates the result of the value comparison.

Remarks

An atomic compare and exchange operation compares the value that is stored in the object that is pointed to by Atom against the value that is pointed to by Exp. If the values are equal, the the value that is stored in the object that is pointed to by atom is replaced with Val by using a read-modify-write operation and applying the memory order constraints that are specified by Order1. If the values are not equal, the operation replaces the value that is pointed to by Exp with the value that is stored in the object that is pointed to by Atom and applies the memory order constraints that are specified by Order2.

Parameters

Order2
Second memory_order argument. The value of Order2 cannot be memory_order_release or memory_order_acq_rel, nor can it be stronger than the value of Order1.

Return Value

A bool that indicates the result of the value comparison.

Remarks

An atomic compare and exchange operation compares the value that is stored in the object that is pointed to by Atom with the value that is pointed to by Exp. If the values are equal, the operation replaces the value that is stored in the object that is pointed to by Atom with Val by using a read-modify-write operation and applying the memory-order constraints that are specified by Order1. If the values are not equal, the operation replaces the value that is pointed to by Exp with the value that is stored in the object that is pointed to by Atom and applies the memory-order constraints that are specified by Order2.

A weak atomic compare and exchange operation performs an exchange if the compared values are equal. However, if the values are not equal, the operation is not guaranteed to perform an exchange.

Parameters

Atom
A pointer to an atomic object that stores a value of type T.

Value
A value of type T.

Return Value

The value contained by the atomic object immediately before the operation was performed.

Remarks

The atomic_fetch_and function performs a read-modify-write operation to replace the stored value of Atom with a bitwise and of Value and the current value that is stored in Atom, using the memory_order_seq_cstmemory_order constraint.

Parameters

Return Value

The value contained by the atomic object immediately before the operation was performed.

Remarks

The atomic_fetch_and_explicit function performs a read-modify-write operation to replace the stored value of Atom with a bitwise and of Value and the current value that is stored in Atom, within the memory constraints that are specified by Order.

Parameters

Atom
A pointer to an atomic object that stores a value of type T.

Value
A value of type T.

Return Value

The value contained by the atomic object immediately before the operation was performed.

Remarks

The atomic_fetch_or function performs a read-modify-write operation to replace the stored value of Atom with a bitwise or of Value and the current value that is stored in Atom, using the memory_order_seq_cstmemory_order.

Parameters

Return Value

The value contained by the atomic object immediately before the operation was performed.

Remarks

The atomic_fetch_or_explicit function performs a read-modify-write operation to replace the stored value of Atom with a bitwise or of Value and the current value that is stored in Atom, within the memory_order constraints specified by Order.

Parameters

Return Value

The value of the pointer contained by the atomic object immediately before the operation was performed.

Remarks

The atomic_fetch_sub_explicit function performs a read-modify-write operation to atomically subtract Value from the stored value in Atom, within the memory_order constraints that are specified by Order.

When the atomic type is atomic_address, Value has type ptrdiff_t and the operation treats the stored pointer as a char *.

Parameters

Atom
A pointer to an atomic object that stores a value of type T.

Value
A value of type T.

Return Value

The value contained by the atomic object immediately before the operation was performed.

Remarks

The atomic_fetch_xor function performs a read-modify-write operation to replace the stored value of Atom with a bitwise exclusive or of Value and the current value that is stored in Atom, using the memory_order_seq_cstmemory_order.

Parameters

Return Value

The value contained by the atomic object immediately before the operation was performed.

Remarks

The atomic_fetch_xor_explicit function performs a read-modify-write operation to replace the stored value of Atom with a bitwise exclusive or of Value and the current value that is stored in Atom, within the memory_order constraints that are specified by Order.

Return Value

Acts as a fence—which is a memory synchronization primitive that enforces ordering between load/store operations—between other fences in a calling thread that have signal handlers that are executed in the same thread.

Parameters

Arg
A value of type Ty.

Return Value

The return value is Arg. The evaluation of Arg does not carry a dependency to the function call. By breaking a possible dependency chain, the function might permit the compiler to generate more efficient code.