InterlockedExchangeSubtract function (winbase.h)

Performs an atomic subtraction of two values.

Syntax

unsigned InterlockedExchangeSubtract(
  [in, out] unsigned volatile *Addend,
  [in]      unsigned          Value
);

Parameters

[in, out] Addend

A pointer to a variable. The value of this variable is replaced with the result of the operation.

[in] Value

The value to be subtracted from the variable pointed to by the Addend parameter.

Return value

The function returns the initial value of the Addend parameter.

Remarks

This function generates a full memory barrier (or fence) to ensure that memory operations are completed in order.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header winbase.h (include Windows.h)

See also

Interlocked Variable Access

InterlockedCompareExchange

InterlockedExchange

InterlockedExchangeAdd

InterlockedExchangePointer

Synchronization Functions