The OpenD Programming Language

atomicExchange

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

  1. T atomicExchange(T* here, V exchangeWith)
    pragma(inline, true) pure nothrow @nogc @trusted
    T
    atomicExchange
    if (
    !is(T == shared) &&
    !is(V == shared)
    )
  2. TailShared!T atomicExchange(shared(T)* here, V exchangeWith)
  3. shared(T) atomicExchange(shared(T)* here, shared(V) exchangeWith)

Parameters

here T*

The address of the destination variable.

exchangeWith V

The value to exchange.

Return Value

Type: T

The value held previously by here.

Meta