Breyta

Deila með


_InterlockedIncrement intrinsic functions

Provide compiler intrinsic support for the Win32 Windows SDK InterlockedIncrement function. The _InterlockedIncrement intrinsic functions are Microsoft-specific.

Syntax

long _InterlockedIncrement(
   long volatile * lpAddend
);
long _InterlockedIncrement_acq(
   long volatile * lpAddend
);
long _InterlockedIncrement_rel(
   long volatile * lpAddend
);
long _InterlockedIncrement_nf(
   long volatile * lpAddend
);
short _InterlockedIncrement16(
   short volatile * lpAddend
);
short _InterlockedIncrement16_acq(
   short volatile * lpAddend
);
short _InterlockedIncrement16_rel(
   short volatile * lpAddend
);
short _InterlockedIncrement16_nf (
   short volatile * lpAddend
);
__int64 _InterlockedIncrement64(
   __int64 volatile * lpAddend
);
__int64 _InterlockedIncrement64_acq(
   __int64 volatile * lpAddend
);
__int64 _InterlockedIncrement64_rel(
   __int64 volatile * lpAddend
);
__int64 _InterlockedIncrement64_nf(
   __int64 volatile * lpAddend
);

Parameters

lpAddend
[in, out] Pointer to the variable to be incremented.

Return value

The return value is the resulting incremented value.

Requirements

Intrinsic Architecture Header
_InterlockedIncrement, _InterlockedIncrement16 x86, ARM, x64, ARM64 <intrin.h>
_InterlockedIncrement64 ARM, x64, ARM64 <intrin.h>
_InterlockedIncrement_acq, _InterlockedIncrement_rel, _InterlockedIncrement_nf, _InterlockedIncrement16_acq, _InterlockedIncrement16_rel, _InterlockedIncrement16_nf, _InterlockedIncrement64_acq, _InterlockedIncrement64_rel, _InterlockedIncrement64_nf ARM, ARM64 <intrin.h>

Remarks

There are several variations on _InterlockedIncrement that vary based on the data types they involve and whether processor-specific acquire or release semantics is used.

While the _InterlockedIncrement function operates on 32-bit integer values, _InterlockedIncrement16 operates on 16-bit integer values and _InterlockedIncrement64 operates on 64-bit integer values.

On ARM platforms, use the intrinsics with _acq and _rel suffixes if you need acquire and release semantics, such as at the beginning and end of a critical section. The intrinsic with an _nf ("no fence") suffix doesn't act as a memory barrier.

The variable pointed to by the lpAddend parameter must be aligned on a 32-bit boundary; otherwise, this function fails on multiprocessor x86 systems and any non-x86 systems. For more information, see align.

The Win32 function is declared in Wdm.h or Ntddk.h.

These routines are only available as intrinsics.

Example

For a sample of how to use _InterlockedIncrement, see _InterlockedDecrement.

See also

Compiler intrinsics
Keywords
Conflicts with the x86 Compiler