atomic_fetch_and Function

Performs a bitwise and on a value and an existing value that is stored in an atomic object.

template <class T>
inline T atomic_fetch_and(
   volatile atomic<T>* Atom,
   T Value); noexcept

template <class T>
inline T atomic_fetch_and(
   volatile atomic<T>* Atom,
   T Value); noexcept

Parameters

  • Atom
    A pointer to an atomic object that stores a value of type T.

  • Value
    A value of type T.

Return Value

The value contained by the atomic object immediately before the operation was performed.

Remarks

The atomic_fetch_and function performs a read-modify-write operation to replace the stored value of Atom with a bitwise and of Value and the current value that is stored in Atom, using the memory_order_seq_cstmemory_order constraint.

Requirements

Header: atomic

Namespace: std

See Also

Reference

<atomic>

atomic Structure

atomic_fetch_and_explicit Function