Defined in header <stdatomic.h>
struct atomic_flag;
(since C11)

atomic_flag is an atomic boolean type. Unlike other atomic types, it is guaranteed to be lock-free. Unlike atomic_bool, atomic_flag does not provide load or store operations.


  • C17 standard (ISO/IEC 9899:2018):
    • 7.17.1/4 atomic_flag (p: 200)
    • 7.17.8 Atomic flag type and operations (p: 208-209)
  • C11 standard (ISO/IEC 9899:2011):
    • 7.17.1/4 atomic_flag (p: 273)
    • 7.17.8 Atomic flag type and operations (p: 285-286)

See also

initializes a new atomic_flag
(macro constant)
sets an atomic_flag to true and returns the old value
sets an atomic_flag to false
C++ documentation for atomic_flag

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.