InterlockedExchangePointerAcquire function (Windows)

Switch View :
ScriptFree
InterlockedExchangePointerAcquire function

Applies to: desktop apps only

Atomically exchanges a pair of addresses. The operation is performed with acquire memory access semantics.

Syntax

PVOID __cdecl InterlockedExchangePointerAcquire(
  __inout  PVOID volatile *Target,
  __in     PVOID Value
);

Parameters

Target [in, out]

A pointer to the address to exchange. The function sets the address pointed to by the Target parameter (*Target) to the address that is the value of the Value parameter, and returns the prior value of the Target parameter.

Value [in]

The address to be exchanged with the address pointed to by the Target parameter (*Target).

Return value

The function returns the initial address pointed to by the Target parameter.

Remarks

This function copies the address passed as the second parameter to the first and returns the original address of the first.

On a 64-bit system, the parameters are 64 bits and must be aligned on 64-bit boundaries; otherwise, the function will behave unpredictably. On a 32-bit system, the parameters are 32 bits and must be aligned on 32-bit boundaries.

The interlocked functions provide a simple mechanism for synchronizing access to a variable that is shared by multiple threads. This function is atomic with respect to calls to other interlocked functions.

This function is implemented using a compiler intrinsic where possible. For more information, see the WinBase.h header file and _InterlockedExchangePointer_acq.

This function is supported only on Itanium-based systems.

Requirements

Header

Winnt.h (include Windows.h)

See also

Interlocked Variable Access
InterlockedExchangeAcquire
InterlockedExchangePointer
Synchronization Functions

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012