函数
<atomic>
std::atomic_fetch_and_explicit
template (integral) (1) | template <class T>T atomic_fetch_and_explicit (volatile atomic<T>* obj, T val, memory_order sync) noexcept;template <class T>T atomic_fetch_and_explicit (atomic<T>* obj, T val, memory_order sync) noexcept; |
---|
重载 (2) | T atomic_fetch_and_explicit (volatile A* obj, T val, memory_order sync) noexcept;T atomic_fetch_and_explicit (A* obj, T val, memory_order sync) noexcept; |
---|
Reads the value contained in obj and replaces it by the result of performing a bitwise AND operation between the read value and val (explicit memory order).
Reads the value contained in obj and replaces it by the result of performing a bitwise AND operation between the read value and val.
整个操作是原子的(一个原子读-修改-写操作):在函数读取(并返回)其值到修改其值的时刻之间,该值不会受到其他线程的影响。
该函数使用 sync 参数指定的内存顺序进行同步。
See atomic::fetch_and for the equivalent member function of atomic.