atomicFetchAdd

fnT atomicFetchAdd(MemoryOrder ms = MemoryOrder.seq, T)(ref return scope T val, size_t mod) if ((__traits(isIntegral, T) || is(T == U *, U)) && !is(T == shared)) pure nothrow @nogc @trusted

Atomically adds mod to the value referenced by val and returns the value val held previously. This operation is both lock-free and atomic.

Parameters

valReference to the value to modify.
modThe value to add.

Returns

The value held previously by val.
fnT atomicFetchAdd(MemoryOrder ms = MemoryOrder.seq, T)(ref return scope shared T val, size_t mod) if (__traits(isIntegral, T) || is(T == U *, U)) pure nothrow @nogc @trusted

Ditto