function
<atomic>
std::atomic_fetch_or_explicit
template (integral) (1) | template <class T>T atomic_fetch_or_explicit (volatile atomic<T>* obj, T val, memory_order sync) noexcept;template <class T>T atomic_fetch_or_explicit (atomic<T>* obj, T val, memory_order sync) noexcept; |
---|
overloads (2) | T atomic_fetch_or_explicit (volatile A* obj, T val, memory_order sync) noexcept;T atomic_fetch_or_explicit (A* obj, T val, memory_order sync) noexcept; |
---|
Apply bitwise OR to contained value (explicit memory order)
Reads the value contained in obj and replaces it by the result of performing a bitwise OR operation between the read value and val.
The entire operation is atomic (an atomic read-modify-write operation): the value 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.
The function synchronizes using the memory order specified by argument sync.
See atomic::fetch_or for the equivalent member function of atomic.
Parameters
- obj
- Pointer to an atomic object that contains an integral value.
Type A represents other overloaded atomic types (in case the library does not implement the C-style atomic types as instantiations of atomic).
- val
- Value to apply.
T is the integral type of the value contained by the atomic object (atomic's template parameter).
- sync
- Synchronization mode for the operation.
This shall be one of the values of the enum
type memory_order.
Return value
The contained value before the call.
T is the integral type of the value contained by the atomic object (atomic's template parameter).
Data races
No data races (atomic operation). The operation uses sequential consistency (memory_order_seq_cst).
Exception safety
No-throw guarantee: never throws exceptions.