首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Atomic operations library

如果宏常量__STDC_NO_ATOMICS__(C11)由编译器定义,则不提供此处列出的标题<stdatomic.h>,关键字_Atomic和所有名称。

类型

| Defined in header <stdatomic.h> |

|:----|

| memory_order(C11)| 定义内存排序约束(枚举)|

| atomic_flag(C11)| 无锁原子布尔标志(结构)|

| Defined in header <stdatomic.h> |

|:----|

| ATOMIC_BOOL_LOCK_FREEATOMIC_CHAR_LOCK_FREEATOMIC_CHAR16_T_LOCK_FREEATOMIC_CHAR32_T_LOCK_FREEATOMIC_WCHAR_T_LOCK_FREEATOMIC_SHORT_LOCK_FREEATOMIC_INT_LOCK_FREEATOMIC_LONG_LOCK_FREEATOMIC_LLONG_LOCK_FREEATOMIC_POINTER_LOCK_FREE(C11)| 表明给定的原子类型是无锁的(宏常量)|

| ATOMIC_FLAG_INIT(C11)| 初始化一个新的atomic_flag(宏常量)|

| ATOMIC_VAR_INIT(C11)| 初始化一个新的原子对象(函数宏)|

| kill_dependency(C11)| 为memory_order_consume(函数宏)|打破依赖关系链

函数

| Defined in header <stdatomic.h> |

|:----|

| atomic_flag_test_and_setatomic_flag_test_and_set_explicit(C11)| 将atomic_flag设置为true并返回旧值(函数)|

| atomic_flag_clearatomic_flag_clear_explicit(C11)| 将atomic_flag设置为false(函数)|

| atomic_init(C11)| 初始化现有的原子对象(函数)|

| atomic_is_lock_free(C11)| 指示原子对象是否为无锁(函数)|

| atomic_storeatomic_store_explicit(C11)| 将值存储在原子对象(函数)|中

| atomic_loadatomic_load_explicit(C11)| 从原子对象(函数)|读取一个值

| atomic_exchangeatomic_exchange_explicit(C11)| 用原子对象(函数)|的值交换一个值

| atomic_compare_exchange_strongatomic_compare_exchange_strong_explicitatomic_compare_exchange_weakatomic_compare_exchange_weak_explicit(C11)| 如果旧值是预期值,则用原子对象交换值,否则读取旧值(函数)|

| atomic_fetch_addatomic_fetch_add_explicit(C11)| 原子添加(功能)|

| atomic_fetch_subatomic_fetch_sub_explicit(C11)| 原子减法(函数)|

| atomic_fetch_oratomic_fetch_or_explicit(C11)| 原子逻辑OR(功能)|

| atomic_fetch_xoratomic_fetch_xor_explicit(C11)| 原子逻辑异或(函数)|

| atomic_fetch_andatomic_fetch_and_explicit(C11)| 原子逻辑AND(函数)|

| atomic_thread_fence(C11)| 通用内存顺序依赖的栅栏同步原语(函数)|

| atomic_signal_fence(C11)| 在同一线程(函数)|中执行的线程和信号处理程序之间的栅栏

类型

标准库为核心语言原子类型提供了方便的typedef。

Typedef name

全类型伞

atomic_bool

_Atomic _Bool

atomic_char

_Atomic char

atomic_schar

_Atomic signed char

atomic_uchar

_Atomic unsigned char

atomic_short

_Atomic short

atomic_ushort

_Atomic unsigned short

atomic_int

_Atomic int

atomic_uint

_Atomic unsigned int

atomic_long

_Atomic long

atomic_ulong

_Atomic unsigned long

atomic_llong

_Atomic long long

atomic_ullong

_Atomic unsigned long long

atomic_char16_t

_Atomic char16_t

atomic_char32_t

_Atomic char32_t

atomic_wchar_t

_Atomic wchar_t

atomic_int_least8_t

_Atomic int_least8_t

atomic_uint_least8_t

_Atomic uint_least8_t

atomic_int_least16_t

_Atomic int_least16_t

atomic_uint_least16_t

_Atomic uint_least16_t

atomic_int_least32_t

_Atomic int_least32_t

atomic_uint_least32_t

_Atomic uint_least32_t

atomic_int_least64_t

_Atomic int_least64_t

atomic_uint_least64_t

_Atomic uint_least64_t

atomic_int_fast8_t

_Atomic int_fast8_t

atomic_uint_fast8_t

_Atomic uint_fast8_t

atomic_int_fast16_t

_Atomic int_fast16_t

atomic_uint_fast16_t

_Atomic uint_fast16_t

atomic_int_fast32_t

_Atomic int_fast32_t

atomic_uint_fast32_t

_Atomic uint_fast32_t

atomic_int_fast64_t

_Atomic int_fast64_t

atomic_uint_fast64_t

_Atomic uint_fast64_t

atomic_intptr_t

_Atomic intptr_t

atomic_uintptr_t

_Atomic uintptr_t

atomic_size_t

_Atomic size_t

atomic_ptrdiff_t

_Atomic ptrdiff_t

atomic_intmax_t

_Atomic intmax_t

atomic_uintmax_t

_Atomic uintmax_t

参考

  • C11 standard (ISO/IEC 9899:2011):
    • 7.17 Atomics <stdatomic.h> (p: 273-286)
    • 7.31.8 Atomics <stdatomic.h> (p: 455-456)

另请参阅

| 用于Atomic操作库的C ++文档

|:----|

扫码关注便宜云服务器开发者

领取便宜云服务器代金券

http://www.vxiaotou.com