网站首页  词典首页

请输入您要查询的函数:

 

术语 interlockedcompareexchange
释义 InterlockedCompareExchange
语法:
C++
LONG __cdecl InterlockedCompareExchange(
__inout LONG volatile *Destination,
__in LONG Exchange,
__in LONG Comparand
);
InterlockedCompareExchange功能
执行一个原子的比较,并在指定的值交换操作。函数比较另一个32位值为基础的比较的结果两个指定的32位值和交流。
如果您是交换指针值,这个功能已被取代了InterlockedCompareExchangePointer功能。
操作在64位的值,使用InterlockedCompareExchange64功能。
参数
目的地[ in , out ]
一个目的地的价值指针。
外汇 [in]
交换价值。
Comparand [in]
该值比较目的地。
返回值
该函数返回目的地参数的初始值。
备注
比较函数与Comparand价值目标的价值。如果目标的价值等于Comparand价值,交换价值都将保存在目的地指定的地址。否则,任何操作执行。
此函数的参数必须对齐32位边界,否则,该函数将表现在多处理器的x86系统和不可预测的任何非x86系统。见_aligned_malloc。
在互锁功能提供了一个同步进入一个变量是由多个线程共享的简单机制。此函数是原子与其他方面的互锁函数的调用。
此功能是使用一个编译器的内在可能的情况下。有关详细信息,请参阅Winbase.h头文件和_InterlockedCompareExchange。
这个函数生成一个完整的内存屏障(或栅栏),以确保内存操作才能完成。
英特尔森林小组:对于性能要求较高的应用程序,使用InterlockedCompareExchangeAcquire或InterlockedCompareExchangeRelease代替。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
互锁变量访问
InterlockedCompare64Exchange128
InterlockedCompareExchange64
InterlockedCompareExchangeAcquire
InterlockedCompareExchangePointer
InterlockedCompareExchangeRelease
同步功能
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==InterlockedCompareExchange Function
Performs an atomic compare-and-exchange operation on the specified values. The function compares two specified 32-bit values and exchanges with another 32-bit value based on the outcome of the comparison.
If you are exchanging pointer values, this function has been superseded by the InterlockedCompareExchangePointer function.
To operate on 64-bit values, use the InterlockedCompareExchange64 function.
Syntax
C++
LONG __cdecl InterlockedCompareExchange(
__inout LONG volatile *Destination,
__in LONG Exchange,
__in LONG Comparand
);
Parameters
Destination [in, out]
A pointer to the destination value.
Exchange [in]
The exchange value.
Comparand [in]
The value to compare to Destination.
Return Value
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 parameters for this function must be aligned on a 32-bit boundary; otherwise, the 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 _InterlockedCompareExchange .
This function generates a full memory barrier (or fence) to ensure that memory operations are completed in order.
Intel IPF: For performance-critical applications, use InterlockedCompareExchangeAcquire or InterlockedCompareExchangeRelease instead.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Interlocked Variable Access
InterlockedCompare64Exchange128
InterlockedCompareExchange64
InterlockedCompareExchangeAcquire
InterlockedCompareExchangePointer
InterlockedCompareExchangeRelease
Synchronization Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms683560(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:20:03