template <class _Ty> inline bool atomic_compare_exchange_strong_explicit( volatile atomic<Ty> *Atom, Ty *Exp, Ty Value, memory_order Order1, memory_order Order2 ) _NOEXCEPT; template <class Ty> inline bool atomic_compare_exchange_strong_explicit( atomic<Ty> *Atom, Ty *Exp, Ty Value, ...
bool atomic_compare_exchange_strong_explicit(volatileA*object,C*expected,Cdesired, memory_ordersuccess, memory_orderfailure) noexcept; bool atomic_compare_exchange_strong_explicit(A*object,C*expected,Cdesired, memory_ordersuccess, memory_orderfailure) noexcept; ...
template< class T > bool atomic_compare_exchange_strong_explicit( volatile std::atomic<T>* obj, T* expected, T desired, std::memory_order succ, std::memory_order fail ); 原子比较对象表示所指向的对象的obj所指向的对象的对象表示形式。expected,好像std::memcmp,如果这些是按位相等的,则将...
atomic_compare_exchange_strong_explicit 函式 執行不可部分完成的比較和交換作業。 複製 template <class T> inline bool atomic_compare_exchange_strong_explicit( volatile atomic<Ty>* Atom, Ty* Exp, Ty Value, memory_order Order1, memory_order Order2) noexcept; template <class Ty> inline bool atomi...
atomic_compare_exchange_strong_explicit atomic_compare_exchange_weak atomic_compare_exchange_weak_explicit atomic_exchange atomic_exchange_explicit atomic_fetch_add atomic_fetch_add_explicit atomic_fetch_and atomic_fetch_and_explicit atomic_fetch_or ...
在头文件<stdatomic.h>中定义_Bool atomic_compare_exchange_strong(volatile A * obj,C * expected,C desired);(1)(自C11以来)_Bool atomic_compare_exchange_weak(volatile A * obj,C * expected,C desired);(2)(自C11以来)_Bool atomic_compare_exchange_strong_explicit(volatile A * obj,C *...
The atomic_compare_exchange_strong_explicit() function takes two memory_order parameters, success and failure (as does atomic_compare_exchange_weak_explicit()). Unpicking the C11/C18 Standards, I find that the allowed values for success and failure are: success = memory_order_re...
atomic_compare_exchange_strong表现为如同原子地执行下列代码: if(memcmp(obj, expected,sizeof*obj)==0)memcpy(obj,&desired,sizeof*obj);elsememcpy(expected, obj,sizeof*obj); 引用 参阅 atomic_exchangeatomic_exchange_explicit (C11) 与原子对象的值交换值 ...
因此对于某些不需要采用循环操作的算法而言, 通常采用 atomic_compare_exchange_strong更好。 atomic_compare_exchange_strong_explicit 比较并交换被封装的值(strong)与参数expected所指定的值是否相等,如果: 相等,则用 val 替换原子对象的旧值。 不相等,则用原子对象的旧值替换expected,因此调用该函数之后,如果被该原...
atomic_compare_exchange_strong_explicit功能 执行 基本比较和交换 操作。 atomic_compare_exchange_weak功能 执行 弱基本比较和交换 操作。 atomic_compare_exchange_weak_explicit功能 执行 弱基本比较和交换 操作。 atomic_exchange 函数 替换存储的值。 atomic_exchange_explicit功能 替换存储的值。 atomic_fetch_add ...