Share via


atomic_exchange_explicit Function

Replaces the stored value of Atom with Value.

template <class Ty>
inline Ty atomic_exchange_explicit(
   volatile atomic<Ty> *Atom,
   Ty Value,
   memory_order Order
) _NOEXCEPT;
template <class Ty>
inline Ty atomic_exchange_explicit(
   atomic<Ty> *Atom,
   Ty Value,
   memory_order Order
) _NOEXCEPT;

Parameters

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

  • Value
    A value of type Ty.

  • Order
    A memory_order.

Return Value

The stored value of Atom before the exchange.

Remarks

The atomic_exchange_explicit function performs a read-modify-write operation to exchange the value that is stored in Atom with Value, within the memory constraints that are specified by Order.

Requirements

Header: atomic

Namespace: std

See Also

Reference

<atomic>

atomic Structure