Lock and Atomic Operation Related Intrinsics

Intrinsic Description

long _InterlockedIncrement(long *addend)

Increment the addend by one atomically. Maps to the fetchadd4 instruction.

long _InterlockedDecrement(long *addend)

Decrement the addend by one atomically. Maps to the fetchadd4 instruction.

long _InterlockedExchange( long *Target, long value)

Do an exchange operation atomically. Maps to the xchg4 instruction.

long _InterlockedCompareExchange( long *Destination, long Exchange, long Comperand)

Do a compare and exchange operation atomically. Maps to the cmpxchg4 instruction with appropriate setup.

void * _InterlockedCompareExchangePointer( void **Destination, void *Exchange, void *Comperand)

 

long _InterlockedExchangeAdd( long *addend, long increment)

Use compare and exchange to do an atomic add of the increment value to the addend. Maps to a loop with the cmpxchg4 instruction to guarantee atomicity.

long _InterlockedAdd( long *addend, long increment)

Returns new value, not the original value.

__int64 _InterlockedIncrement64(__int64 *addend)

Increment the addend by one atomically. Maps to the fetchadd instruction.

__int64 _InterlockedDecrement64( __int64 *addend)

Decrement the addend by one atomically. Maps to the fetchadd instruction.

__int64 _InterlockedExchange64( __int64 *Target, __int64 value)

Do an exchange operation atomically. Maps to the xchg instruction.

__int64 _InterlockedCompareExchange64( __int64 *Destination, __int64 Exchange, __int64 Comperand)

Do a compare and exchange operation atomically. Maps to the cmpxchg instruction with appropriate setup

__int64 _InterlockedExchangeAdd64( __int64 *addend, __int64 increment)

Use compare and exchange to do an atomic add of the increment value to the addend. Maps to a loop with the cmpxchg instruction to guarantee atomicity

__int64 _InterlockedAdd64( __int64 *addend, __int64 increment)

Returns new value, not the original value.

void _ReleaseSpinLock(_int32 *x)

Release spin lock.