函式
<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.