public member function
<atomic>
std::atomic::fetch_or
T fetch_or (T val, memory_order sync = memory_order_seq_cst) volatile noexcept;T fetch_or (T val, memory_order sync = memory_order_seq_cst) noexcept;
Apply bitwise OR to contained value
Reads the contained value 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.
This member function is only defined in the atomic specializations for integral types (except for bool
).
If the default value is used for the second argument, this function is equivalent to atomic::operator&=.
Parameters
- val
- Value to apply.
T is atomic's template parameter (the type of the contained value).
ptrdiff_t is a signed integral type.
- 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 atomic's template parameter (the type of the contained value).
Data races
No data races (atomic operation). Memory order specified by argument sync.
Exception safety
No-throw guarantee: never throws exceptions.