atomicExchange

Exchange exchangeWith with the memory referenced by here. This operation is both lock-free and atomic.

  1. T atomicExchange(T* here, V exchangeWith)
  2. TailShared!T atomicExchange(shared(T)* here, V exchangeWith)
  3. shared(T) atomicExchange(shared(T)* here, shared(V) exchangeWith)
    pure nothrow @nogc @trusted
    shared(T)
    atomicExchange
    (
    shared(T)* here
    ,
    shared(V) exchangeWith
    )
    if (
    is(T == class) ||
    is(T == interface)
    )
    in (atomicPtrIsProperlyAligned(here), "Argument `here` is not properly aligned")
  4. alias Thunk = V

Parameters

here
Type: shared(T)*

The address of the destination variable.

exchangeWith
Type: shared(V)

The value to exchange.

Return Value

Type: shared(T)

The value held previously by here.

Suggestion Box / Bug Report