atomic_compare_exchange 函式
不可分開比較在一個記憶體位置的此值,為了和一個預期的值全等。如果值相同,記憶體位置以新值取代。
inline bool atomic_compare_exchange(
_Inout_ int * _Dest,
_Inout_ int * _Expected_value,
int _Value
) restrict(amp);
inline bool atomic_compare_exchange(
_Inout_ unsigned int * _Dest,
_Inout_ unsigned int * _Expected_value,
unsigned int _Value
) restrict(amp);
參數
_Dest
指向記憶體位置的指標。_Expected_value
要和記憶體位置進行比較的值。_Value
要設定進記憶體位置的新值。
傳回值
如果作業成功,則為 true,否則為 false。
需求
標頭檔: amp.h
**命名空間:**並行