atomicExchange

fnT atomicExchange(MemoryOrder ms = MemoryOrder.seq, T, V)(T * here, V exchangeWith) if (!is(T == shared) && !is(V == shared)) pure nothrow @nogc @trusted

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

Parameters

hereThe address of the destination variable.
exchangeWithThe value to exchange.

Returns

The value held previously by here.
fnTailShared!T atomicExchange(MemoryOrder ms = MemoryOrder.seq, T, V)(shared(T) * here, V exchangeWith) if (!is(T == class) && !is(T == interface)) pure nothrow @nogc @trusted

Ditto

fnshared(T) atomicExchange(MemoryOrder ms = MemoryOrder.seq, T, V)(shared(T) * here, shared(V) exchangeWith) if (is(T == class) || is(T == interface)) pure nothrow @nogc @trusted

Ditto