Overview
Group
Quick Info

Windows NT
Yes
Win95
No
Win32s
No
Import Library
kernel32.lib
Header File
winbase.h
Unicode
No
Platform Notes
None

InterlockedExchangeAdd

[New - Windows NT]

The InterlockExchangeAdd function performs an atomic addition of an increment value to an addend variable. The function prevents more than one thread from using the same variable simultaneously.

LONG InterlockedExchangeAdd (

PLONG Addend,
// pointer to the addend
LONG Increment
// increment value
);

Parameters

Addend

Specifies the address of the number that will have the Increment number added to it.

Increment

Specifies the number to be added to the variable pointed to by the Addend parameter.

Return Values

The return value is the initial value of the Addend parameter.

Remarks

The functions InterlockedExchangeAdd, InterlockedCompareExchange, InterlockedDecrement, InterlockedExchange, and InterlockedIncrement provide a simple mechanism for synchronizing access to a variable that is shared by multiple threads. The threads of different processes can use this mechanism if the variable is in shared memory.

The InterlockedExchangeAdd function performs an atomic addition of the Increment value to the Addend value. The result is stored in the address specified by Addend. The initial value of Addend is returned as the function value.

The variables for InterlockedExchangeAdd must be aligned on a 32-bit boundary; otherwise, this function will fail on multiprocessor x86 systems.

See Also

InterlockedCompareExchange
, InterlockedDecrement, InterlockedExchange, InterlockedIncrement

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database