InterlockedIncrement routine

The InterlockedIncrement routine increments a caller-supplied variable as an atomic operation.

Syntax


LONG InterlockedIncrement(
  _Inout_ LONG volatile *Addend
);

Parameters

Addend [in, out]

A pointer to a variable of type LONG.

Return value

InterlockedIncrement returns the incremented value.

Remarks

InterlockedIncrement should be used instead of ExInterlockedIncrementLong because it is both more efficient and faster.

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

InterlockedIncrement is atomic only with respect to other InterlockedXxx calls.

Interlocked operations cannot be used on non-cached memory.

Requirements

Target platform

Universal

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

OneCoreUAP.lib on Windows 10

IRQL

Any level

See also

InterlockedDecrement
InterlockedExchange
ExInterlockedAddLargeInteger
ExInterlockedAddUlong

 

 

Send comments about this topic to Microsoft

Show: