Exportar (0) Imprimir
Expandir todo
Expandir Minimizar

_InterlockedExchange Intrinsic Functions

Microsoft Specific

Provide compiler intrinsic support for the Win32 Windows SDKInterlockedExchange function.

long _InterlockedExchange(
   long * Target,
   long Value
long _InterlockedExchange_acq(
   long * Target,
   long Value
__int64 _InterlockedExchange64(
   __int64 * Target,
   __int64 Value
__int64 _InterlockedExchange64_acq(
   __int64 * Target,
   __int64 Value

[in, out] Target

Pointer to the value to be exchanged. The function sets this variable to Value and returns its prior value.

[in] Value

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

Returns the initial value pointed to by Target.




x86, IPF, x64




IPF, x64



Header file <intrin.h>

There are several variations on _InterlockedExchange that vary based on the data types they involve and whether processor-specific acquire or release semantics is used.

While the _InterlockedExchange function operates on 32-bit integer values, _InterlockedExchange64 operates on 64-bit integer values.

The _InterlockedExchange_acq and _InterlockedExchange64_acq intrinsic functions are the same as the corresponding functions without the _acq suffix except that the operation is performed with acquire semantics, which is useful when entering 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.

For a sample of how to use _InterlockedExchange, see _InterlockedDecrement.

Adiciones de comunidad

© 2015 Microsoft