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

Atomically exchanges a pair of values.

LONG InterlockedExchange(
    LPLONG volatile Target,
    LONG Value
);

Parameters

Target
Pointer to the LONG value to exchange. The function sets this LONG value to Value, and returns its prior value.
Value
Specifies a new value for the LONG value pointed to by Target.

Remarks

InterlockedExchange, InterlockedDecrement, InterlockedCompareExchange, InterlockedExchangeAdd, and InterlockedIncrement 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 original value of the Target parameter.

Requirements

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

Note

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

See Also

InterlockedCompareExchange, InterlockedDecrement, InterlockedExchangeAdd, InterlockedIncrement, iwin32 API, iwin32 Overview