INtime SDK Help
InterlockedExchangeAdd (iwin32)
INtime SDK v7 > About INtime > Alternate APIs > iwin32 API > iwin32 API > InterlockedExchangeAdd (iwin32)

Performs an atomic addition of Value to the value pointed to by Addend. The result is stored in the address specified by Addend. The function prevents more than one thread from simultaneously using the same variable.

LONG InterlockedExchangeAdd (
    LPLONG volatile Addend,
    LONG Increment
);

Parameters

Addend
Pointer to the number to add the Increment number to.
Increment
Specifies the number to add to the variable pointed to by the Addend parameter.

Remarks

InterlockedExchangeAdd, InterlockedCompareExchange, InterlockedDecrement, InterlockedExchange, 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.

The variables for InterlockedExchangeAdd must be aligned on a 32-bit boundary.

Return Values

The initial value of the variable pointed to by the Addend 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, InterlockedExchange, InterlockedIncrement, iwin32 API, iwin32 Overview