ATOMIC_*_LOCK_FREE

来自cppreference.com
< c‎ | atomic
在标头 <stdatomic.h> 定义
#define ATOMIC_BOOL_LOCK_FREE     /* implementation-defined */

#define ATOMIC_CHAR_LOCK_FREE     /* implementation-defined */
#define ATOMIC_CHAR16_T_LOCK_FREE /* implementation-defined */
#define ATOMIC_CHAR32_T_LOCK_FREE /* implementation-defined */
#define ATOMIC_WCHAR_T_LOCK_FREE  /* implementation-defined */
#define ATOMIC_SHORT_LOCK_FREE    /* implementation-defined */
#define ATOMIC_INT_LOCK_FREE      /* implementation-defined */
#define ATOMIC_LONG_LOCK_FREE     /* implementation-defined */
#define ATOMIC_LLONG_LOCK_FREE    /* implementation-defined */

#define ATOMIC_POINTER_LOCK_FREE  /* implementation-defined */
(C11 起)
#define ATOMIC_CHAR8_T_LOCK_FREE  /* implementation-defined */
(C23 起)

展开成求值为 012预处理器常量表达式,它指示对应原子类型(有符号及无符号一同)的免锁属性。

解释
0 该原子类型决不免锁
1 该原子类型有时免锁
2 该原子类型始终免锁

引用

  • C17 标准(ISO/IEC 9899:2018):
  • 7.17.1/3 atomic lock-free macros (第 200 页)
  • C11 标准(ISO/IEC 9899:2011):
  • 7.17.1/3 atomic lock-free macros (第 273 页)