The InterlockedCompareExchangeRelease routine uses release semantics to atomically update the value of a variable if that variable is equal to a specified value.
LONG InterlockedCompareExchangeRelease( _Inout_ LONG volatile *Destination, _In_ LONG Exchange, _In_ LONG Comparand );
Destination [in, out]
A pointer to the variable to compare with Comparand. If the variable is equal to Comparand, the variable receives the value of Exchange; otherwise, the variable remains unchanged.
Specifies the value that *Destination receives if *Destination = Comparand.
Specifies the value to compare to *Destination.
InterlockedCompareExchangeRelease returns the original value of *Destination.
The InterlockedCompareExchangeRelease routine performs the same operation as InterlockedCompareExchange, except that the former guarantees only release semantics whereas the latter guarantees both acquire and release semantics. For more information about acquire and release semantics, see Acquire and Release Semantics.
On processors that do not support release-semantics operations, InterlockedCompareExchangeRelease is identical to InterlockedCompareExchange. On processors such as Intel Itanium-based processors, which do support these operations, InterlockedCompareExchangeRelease runs faster.
Interlocked operations cannot be used on non-cached memory.
Available only on Windows Server 2003 and later versions of the Windows operating system.
|Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)|