我要评分
获取效率
正确性
完整性
易理解

Atomic Operations

Operation Type

Function

Atomic read

type __atomic_load_n(type *ptr,int memmodel)

Atomic write

void __atomic_store_n (type *ptr, type val, int memmodel)

Atomic exchange

type __atomic_exchange_n (type *ptr, type val, int memmodel)

Atomic CAS

bool __atomic_compare_exchange_n (type *ptr, type *expected, type desired, bool weak, int success_memmodel, int failure_memmodel)

Atomic addition, subtraction, AND, OR, and XOR

type __atomic_op_fetch (type *ptr, type val, int memorder)

type __atomic_fetch_op (type *ptr, type val, int memorder)

add/sub/and/xor/or/nand

Atomic TAS

bool __atomic_test_and_set (void *ptr, int memorder)

Atomic Clear

void __atomic_clear (bool *ptr, int memorder)