Namespaces
Variants
Views
Actions

std::atomic_fetch_or, std::atomic_fetch_or_explicit

From cppreference.com
Defined in header <atomic>
template< class Integral >
Integral atomic_fetch_or( std::atomic<Integral>* obj, Integral arg );
(1) (since C++11)
template< class Integral >
Integral atomic_fetch_or( volatile std::atomic<Integral>* obj, Integral arg );
(2) (since C++11)
template< class Integral >

Integral atomic_fetch_or_explicit( std::atomic<Integral>* obj, Integral arg,

                                   std::memory_order order );
(3) (since C++11)
template< class Integral >

Integral atomic_fetch_or_explicit( volatile std::atomic<Integral>* obj, Integral arg,

                                   std::memory_order order );
(4) (since C++11)

1-2) Atomically replaces the value pointed by arg with the result of bitwise OR between the old value of obj and arg, and returns the value obj held previously, as if by obj->fetch_and(arg)

3-4) Atomically replaces the value pointed by arg with the result of bitwise OR between the old value of obj and arg, and returns the value obj held previously, as if by obj->fetch_and(arg, order)

Contents

[edit] Parameters

obj - pointer to the atomic object to modify
arg - the value to bitwise OR to the value stored in the atomic object
order - the memory sycnhronization ordering for this operation: all values are permitted.

[edit] Return value

The value held previously by the atomic object pointed to by obj

[edit] Exceptions

noexcept specification:  
noexcept
  (since C++11)

[edit] Possible implementation

[edit] Example

[edit] See also

(C++11)
atomically performs bitwise OR between the argument and the value of the atomic object and obtains the value held previously
(public member function of std::atomic) [edit]
replaces the atomic object with the result of logical AND with a non-atomic argument and obtains the previous value of the atomic
(function template) [edit]
replaces the atomic object with the result of logical XOR with a non-atomic argument and obtains the previous value of the atomic
(function template) [edit]