函数原型:
LONG __cdecl InterlockedCompareExchange(
__in_out LONG volatile* Destination,
__in LONG Exchange,
__in LONG Comparand
);
MSDN上的解释:
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.
我的理解:
第一个参数和第三个参数比较,如果相等,则将第一个参数的值设为第个参数的值.
Return Value
The function returns the initial value of the Destination parameter.
返回的是第一个参数的初始值