Performs an atomic compare-and-exchange operation on the specified values. The function compares the specified 64-bit values and exchanges with the specified 128-bit value based on the outcome of the comparison. The operation is performed with acquire memory ordering semantics.
LONG64 __cdecl InterlockedCompare64ExchangeAcquire128( _Inout_ LONG64 volatile *Destination, _In_ LONG64 ExchangeHigh, _In_ LONG64 ExchangeLow, _In_ LONG64 Comparand );
Destination [in, out]
A pointer to the destination value.
The high-order part of the exchange value.
The low-order part of the exchange value.
The value to compare to Destination.
The function returns the initial value of the Destination parameter.
The function performs an atomic comparison of the Destination value with the Comparand value. If the Destination value is equal to the Comparand value, the Exchange value is stored in the address specified by Destination. Otherwise, no operation is performed. The variable pointed to by the Destination parameter must be aligned on a 128-bit boundary. See _aligned_malloc.
To determine whether the processor supports this operation, call the IsProcessorFeaturePresent function with PF_COMPARE64_EXCHANGE128.
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 _InterlockedCompare64Exchange128_acq.
|WinBase.h (include Windows.h)|