function
<atomic>

std::atomic_store_explicit

template (1)
template <class T>
void atomic_store_explicit (volatile atomic<T>* obj, T val, memory_order sync) noexcept;
template <class T>
void atomic_store_explicit (atomic<T>* obj, T val, memory_order sync) noexcept;
overloads (2)
void atomic_store_explicit (volatile A* obj, T val, memory_order sync) noexcept;
void atomic_store_explicit (A* obj, T val, memory_order sync) noexcept;
Modify contained value (explicit memory order)
Replaces the value contained in obj with val, using the memory order specified by sync.

See atomic::store for the equivalent member function of atomic.

Parameters

obj
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).
val
Value to initialize the contained object with.
T is the type of the value contained in the atomic object (atomic's template parameter).
sync
Synchronization mode for the operation.
This shall be one of the following values of the enum type memory_order:

Return value

none

Data races

No data races (atomic operation). Memory order specified by argument sync.

Exception safety

No-throw guarantee: never throws exceptions.

See also