|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
_InterlockedExchangePointer Intrinsic Functions
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 );
- [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.
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.