INtime SDK Help
InterlockedCompareExchangePointer (iwin32)
INtime SDK v7.1 > About INtime > Alternate APIs > iwin32 API > iwin32 API > InterlockedCompareExchangePointer (iwin32)

Atomically compares the Destination and Comperand values. If the Destination value equals the Comperand value, the Exchange value is stored in the address specified by Destination. Otherwise, no action occurs. All operands are 32-bits.

If you are exchanging pointer values, this function supersedes InterlockedCompareExchange.

PVOID InterlockedCompareExchangePointer (
    PVOID volatile * Destination,
    PVOID Exchange,
    PVOID Comperand


Pointer to the pointer to the destination value.
Exchange value.
Value to compare to Destination.


The interlocked functions provide a simple mechanism for synchronizing access to a variable shared by multiple threads. If the variable is in shared memory, threads of different processes can use this mechanism.

Return Values

The destination's initial value.


Versions Defined in Include Link to
INtime 3.0 intime/rt/include/winbase.h windows.h iwin32.lib


This function operates in the real-time portion of your application.

See Also

InterlockedCompareExchange, iwin32 API, iwin32 Overview