View source code
Display the source code in core/atomic.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function core.atomic.atomicExchange

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

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

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

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

Parameters

NameDescription
here The address of the destination variable.
exchangeWith The value to exchange.

Returns

The value held previously by here.

Authors

Sean Kelly, Alex Rønne Petersen, Manu Evans

License

Boost License 1.0