atomicFetchSub

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

  1. T atomicFetchSub(ref T val, size_t mod)
    pure nothrow @nogc @trusted
    T
    atomicFetchSub
    (
    ref T val
    ,
    size_t mod
    )
    if (
    (
    __traits(isIntegral, T) ||
    is(T == U*,
    U
    )
    )
    &&
    !is(T == shared)
    )
    in (atomicValueIsProperlyAligned(val))
  2. T atomicFetchSub(ref shared T val, size_t mod)

Parameters

val
Type: T

Reference to the value to modify.

mod
Type: size_t

The value to subtract.

Return Value

Type: T

The value held previously by val.

Suggestion Box / Bug Report