名前空間
変種
操作

アトミック操作ライブラリ

From cppreference.com
< c

コンパイラによってマクロ定数 __STDC_NO_ATOMICS__(C11) が定義されている場合、ヘッダー <stdatomic.h>、キーワード _Atomic、およびここにリストされているすべての名前は提供されません。

目次

[編集]

ヘッダ<stdatomic.h>で定義
メモリ順序制約を定義する
(enum) [編集]
ロックフリーアトミックブーリアンフラグ
(構造体)[編集]

[編集] マクロ

ヘッダ<stdatomic.h>で定義
指定されたアトミック型がロックフリーであることを示す
(マクロ定数) [編集]
新しいatomic_flagを初期化する
(マクロ定数) [編集]
(C11)(C17で非推奨)(C23で削除)
新しいアトミックオブジェクトを初期化する
(関数マクロ) [編集]
memory_order_consumeの依存関係チェーンを中断する
(関数マクロ) [編集]

[編集] 関数

ヘッダ<stdatomic.h>で定義
atomic_flagをtrueに設定し、古い値を返す
(関数) [編集]
atomic_flagをfalseに設定する
(関数) [編集]
既存のアトミックオブジェクトを初期化する
(関数) [編集]
アトミックオブジェクトがロックフリーであるかを示す
(関数) [編集]
アトミックオブジェクトに値を格納する
(関数) [編集]
アトミックオブジェクトから値を読み込む
(関数) [編集]
アトミックオブジェクトの値と値を交換する
(関数) [編集]
古い値が期待値と同じであればアトミックオブジェクトと値を交換し、そうでなければ古い値を読み込む
(関数) [編集]
アトミック加算
(関数) [編集]
アトミック減算
(関数) [編集]
アトミックビットOR
(関数) [編集]
アトミックビット排他的OR
(関数) [編集]
アトミックビットAND
(関数) [編集]
汎用的なメモリ順序依存のフェンス同期プリミティブ
(関数) [編集]
スレッドと、同じスレッドで実行されるシグナルハンドラとの間のフェンス
(関数) [編集]

[編集]

標準ライブラリは、コア言語のアトミック型の便利な typedef を提供します。

Typedef名 完全型名
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_char8_t (C23) _Atomic char8_t
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

[編集] 参考文献

  • C23標準 (ISO/IEC 9899:2024)
  • 7.17 アトミックス <stdatomic.h> (p: TBD)
  • 7.31.8 アトミクス <stdatomic.h> (p: TBD)
  • C17標準 (ISO/IEC 9899:2018)
  • 7.17 アトミックス <stdatomic.h> (p: TBD)
  • 7.31.8 アトミクス <stdatomic.h> (p: TBD)
  • C11標準 (ISO/IEC 9899:2011)
  • 7.17 アトミックス <stdatomic.h> (p: 273-286)
  • 7.31.8 アトミクス <stdatomic.h> (p: 455-456)

[編集] 関連項目

C++ のドキュメントアトミック操作ライブラリ の)
English 日本語 中文(简体) 中文(繁體)