InterlockedCompareExchange例程

来源:互联网 发布:耽美小说软件 编辑:程序博客网 时间:2024/05/17 07:35

InterlockedCompareExchange 例程执行一个原子操作,用参数Comparand的值与参数Destination指针指向的值比较。

Syntax:

LONG InterlockedCompareExchange( _Inout_ LONG volatile * Destination, _In_ LONG Exchange, _In_ LONG Comparand );

Parameters:

Destination [in, out]
指向输入值的指针,和Comparand的值比较。

Exchange [in]
如果Destination指针指向的值和Comparand的值一样,就把Destination指针指向的值换成Exchange的值。

Comparand [in]指定与Destination 指针指向值比较的值。

Return value
返回*Destination的原始值。

Remarks
当Comparand 和*Destination相等时,*Destination的值设为Exchange 一样。否则,*Destination值不变。

Requirements
Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library
OneCoreUAP.lib on Windows 10

IRQL
Any level

See also
ExInterlockedCompareExchange64
InterlockedCompareExchangePointer
InterlockedDecrement
InterlockedExchange
InterlockedExchangePointer
InterlockedIncrement

0 0