Skip to content

Latest commit

 

History

History
170 lines (93 loc) · 5.62 KB

nf-winnt-interlockedcompareexchange64.md

File metadata and controls

170 lines (93 loc) · 5.62 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:winnt.InterlockedCompareExchange64
InterlockedCompareExchange64 function (winnt.h)
Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 64-bit values and exchanges with another 64-bit value based on the outcome of the comparison.
InterlockedCompareExchange64
InterlockedCompareExchange64 function
base.interlockedcompareexchange64
winnt/InterlockedCompareExchange64
base\interlockedcompareexchange64.htm
backup
b0799de3-49f9-4eef-9c14-d145f42ce57b
12/05/2018
InterlockedCompareExchange64, InterlockedCompareExchange64 function, base.interlockedcompareexchange64, winnt/InterlockedCompareExchange64
winnt.h
Windows.h
Windows
Windows Vista [desktop apps \| UWP apps]
Windows Server 2003 [desktop apps \| UWP apps]
Kernel32.lib
Kernel32.dll
Windows
19H1
InterlockedCompareExchange64
winnt/InterlockedCompareExchange64
c++
APIRef
kbSyntax
DllExport
Kernel32.dll
API-MS-Win-Core-Interlocked-l1-1-0.dll
API-MS-Win-Core-Interlocked-l1-2-0.dll
KernelBase.dll
MinKernelBase.dll
InterlockedCompareExchange64

InterlockedCompareExchange64 function

-description

Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 64-bit values and exchanges with another 64-bit value based on the outcome of the comparison.

-parameters

-param Destination [in, out]

A pointer to the destination value.

-param ExChange [in]

The exchange value.

-param Comperand [in]

The value to compare to Destination.

-returns

The function returns the initial value of the Destination parameter.

-remarks

The function compares 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 variables for this function must be aligned on a 64-bit boundary; otherwise, this function will behave unpredictably on multiprocessor x86 systems and any non-x86 systems. See _aligned_malloc.

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 _InterlockedCompareExchange64.

This function generates a full memory barrier (or fence) to ensure that memory operations are completed in order.

Itanium-based systems:  For performance-critical applications, use InterlockedCompareExchangeAcquire64 or InterlockedCompareExchangeRelease64 instead.

Note  This function is supported on Windows RT-based systems.
 

-see-also

Interlocked Variable Access

InterlockedCompare64Exchange128

InterlockedCompareExchange

InterlockedCompareExchange128

InterlockedCompareExchange16

InterlockedCompareExchange16Acquire

InterlockedCompareExchange16NoFence

InterlockedCompareExchange16Release

InterlockedCompareExchangeAcquire

InterlockedCompareExchangeAcquire64

InterlockedCompareExchangeNoFence

InterlockedCompareExchangeNoFence64

InterlockedCompareExchangePointer

InterlockedCompareExchangePointerAcquire

InterlockedCompareExchangePointerNoFence

InterlockedCompareExchangePointerRelease

InterlockedCompareExchangeRelease

InterlockedCompareExchangeRelease64

Synchronization Functions