Skip to content

InterlockedExchangeAdd

Thread-safe add and exchange of 2 values

Declaration

Source position: systemh.inc line 1529

  function InterlockedExchangeAdd(var Target: LongInt; Source: LongInt)
                                  : LongInt;
  function InterlockedExchangeAdd(var Target: Pointer; Source: Pointer)
                                  : Pointer;
  function InterlockedExchangeAdd(var Target: Cardinal; Source: Cardinal)
                                  : Cardinal;

Description

InterLockedExchangeAdd adds to Target the value of Source in a thread-safe way, and returns the old value of Target.This is done in a thread-safe way, i.e., only one processor is accessing the Target variable at a time.

Errors

None.

See also

Name Description
InterlockedCompareExchange Conditional exchange
InterLockedDecrement Thread-safe decrement
InterLockedExchange Exchange 2 integers in a thread-safe way
InterLockedIncrement Thread-safe increment