Export (0) Print
Expand All
Expand Minimize

_InterlockedExchangePointer Intrinsic Functions

Microsoft Specific

Perform an atomic exchange operation, which copies the address passed in as the second argument to the first and returns the original address of the first.


void * _InterlockedExchangePointer(
   void * volatile * Target,
   void * Value
);
void * _InterlockedExchangePointer_acq(
   void * volatile * Target,
   void * Value
);

Parameters

[in, out] Target

Pointer to the pointer to the value to exchange. The function sets the value to Value and returns its previous value.

[in] Value

Value to be exchanged with the value pointed to by Target.

The function returns the initial value pointed to by Target.

Intrinsic Architecture

_InterlockedExchangePointer

IPF, x64

_InterlockedExchangePointer_acq

IPF

Note   On the x86 architecture, _InterlockedExchangePointer is a macro that calls _InterlockedExchange.

Header file <intrin.h>

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

Use _InterlockedExchangePointer_acq if you need acquire semantics, such as at the beginning of a critical section.

There is no version of this function that uses release semantics.

In Visual C++ 2005, these functions behave as read-write memory barriers. For more information, see _ReadWriteBarrier.

These routines are only available as intrinsics.

END Microsoft Specific

Community Additions

ADD
Show:
© 2014 Microsoft