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.atomicFetchAdd

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

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

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

Parameters

NameDescription
val Reference to the value to modify.
mod The value to add.

Returns

The value held previously by val.

Authors

Sean Kelly, Alex Rønne Petersen, Manu Evans

License

Boost License 1.0