InterlockedExchangeAdd - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// miniport.h

LONG InterlockedExchangeAdd(
  [in, out] LONG volatile *Addend,
  [in]      LONG          Value
);

View the official Windows Driver Kit DDI reference
// wdm.h

LONG InterlockedExchangeAdd(
  [in, out] LONG volatile *Addend,
  [in]      LONG          Value
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-miniport-interlockedexchangeadd)

InterlockedExchangeAdd function (miniport.h)

Description

The InterlockedExchangeAdd routine adds a value to a given integer as an atomic operation and returns the original value of the given integer.

Parameters

Addend [in, out]

A pointer to an integer variable.

Value [in]

Specifies the value to be added to Addend.

Return value

InterlockedExchangeAdd returns the original value of the Addend variable when the call occurred.

Remarks

InterlockedExchangeAdd should be used instead of ExInterlockedAddUlong because it is both faster and more efficient.

InterlockedExchangeAdd is implemented inline by the compiler when appropriate and possible. It does not require a spin lock and can therefore be safely used on pageable data.

InterlockedExchangeAdd is atomic only with respect to other InterlockedXxx calls.

Interlocked operations cannot be used on non-cached memory.

See also

ExInterlockedAddLargeInteger

ExInterlockedAddUlong

InterlockedDecrement

InterlockedIncrement


Windows Driver Kit DDI reference (nf-wdm-interlockedexchangeadd)

InterlockedExchangeAdd function (wdm.h)

Description

The InterlockedExchangeAdd routine adds a value to a given integer as an atomic operation and returns the original value of the given integer.

Parameters

Addend [in, out]

A pointer to an integer variable.

Value [in]

Specifies the value to be added to Addend.

Return value

InterlockedExchangeAdd returns the original value of the Addend variable when the call occurred.

Remarks

InterlockedExchangeAdd should be used instead of ExInterlockedAddUlong because it is both faster and more efficient.

InterlockedExchangeAdd is implemented inline by the compiler when appropriate and possible. It does not require a spin lock and can therefore be safely used on pageable data.

InterlockedExchangeAdd is atomic only with respect to other InterlockedXxx calls.

Interlocked operations cannot be used on non-cached memory.

See also

ExInterlockedAddLargeInteger

ExInterlockedAddUlong

InterlockedDecrement

InterlockedIncrement