VB声明
Declare Function InterlockedExchange Lib "kernel32" Alias "InterlockedExchange" (Target As Long, ByVal Value As Long) As Long
说明
设置一个长整数变量的值
返回值
Long,变量的前一个值
参数表
参数 类型及说明
Target Long,要设置的变量
Value Long,变量的新值
注解
这个函数执行的操作可以安全地避开同步问题——即使是一个共享变量
The InterlockedExchange function atomically exchanges a pair of values. The function prevents more than one thread from using the same variable simultaneously.
If you are exchanging pointer values, this function has been superseded by the InterlockedExchangePointer function.
To operate on 64-bit memory locations and values, use the InterlockedExchange64 function.
LONG InterlockedExchange(
LONG volatile* Target,
LONG Value
);