, InterlockedIncrement InterlockedDecrement , , , . , , .
, ; .
InterlockedExchange .
LONG InterlockedExchange(LPLONG Target, LONG Value)
, Target, Value. InterlockedExchangeAdd .
LONG InterlockedExchangeAdd(PLONG Addend, LONG Increment)
Increment , Addend, . 2 ( ) , InterlockedIncrement.
, InterlockedCompareExchange, InterlockedExchange, , .
PVOID InterlockedCompareExchange(PVOID *Destination, PVOID Exchange, PVOID Comparand)
( PVOID ):
Temp = *Destination;
if (*Destination == Comparand) *Destination = Exchange;
return Temp;
. *Destination (lock variable), 1 , 0 . Exchange 0, a Comparand 1. , , 1. "", ("spin"), , , , , . , EnterCriticalSection, CRITICAL_SECTION -; 9.