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 起)

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

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

[编辑] 参考

  • C11 standard (ISO/IEC 9899:2011):
  • 7.17.1/3 atomic lock-free macros (p: 273)