template <class T>T atomic_store_explicit (volatile atomic<T>* obj, T val, memory_order sync) noexcept;template <class T>T atomic_store_explicit (atomic<T>* obj, T val, memory_order sync) noexcept;
T atomic_store_explicit (volatile A* obj, T val, memory_order sync) noexcept;T atomic_store_explicit (A* obj, T val, memory_order sync) noexcept;
Read and modify contained value (explicit memory order)
Replaces the value contained in obj with val and returns the value obj had immediately before.
The entire operation is atomic (an atomic read-modify-write operation): the value of obj is not affected by other threads between the instant its value is read (to be returned) and the moment it is modified by this function.
See atomic::exchange for the equivalent member function of atomic.
- Pointer to an atomic object.
Type A represents other overloaded atomic types (if the library does not implement the C-style atomic types as instantiations of atomic).
- Value to assign to the contained object.
T is the type of the value contained in the atomic object (atomic's template parameter).
- Synchronization mode for the operation.
This shall be a values of the
enum type memory_order.
The value contained in obj before the call.
T is the type of the contained value (atomic's template parameter).
No data races (atomic operation). Memory order specified by argument sync.
No-throw guarantee: never throws exceptions.