Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      Atomic operations library

      From cppreference.com
      <c
       
       
       

      If the macro constant__STDC_NO_ATOMICS__(C11) is defined by the compiler, the header<stdatomic.h>, the keyword_Atomic, and all of the names listed here are not provided.

      Contents

      [edit]Types

      Defined in header<stdatomic.h>
      defines memory ordering constraints
      (enum)[edit]
      lock-free atomic boolean flag
      (struct)[edit]

      [edit]Macros

      Defined in header<stdatomic.h>
      indicates that the given atomic type is lock-free
      (macro constant)[edit]
      initializes a newatomic_flag
      (macro constant)[edit]
      (C11)(deprecated in C17)(removed in C23)
      initializes a new atomic object
      (function macro)[edit]
      breaks a dependency chain formemory_order_consume
      (function macro)[edit]

      [edit]Functions

      Defined in header<stdatomic.h>
      sets an atomic_flag to true and returns the old value
      (function)[edit]
      sets an atomic_flag to false
      (function)[edit]
      initializes an existing atomic object
      (function)[edit]
      indicates whether the atomic object is lock-free
      (function)[edit]
      stores a value in an atomic object
      (function)[edit]
      reads a value from an atomic object
      (function)[edit]
      swaps a value with the value of an atomic object
      (function)[edit]
      swaps a value with an atomic object if the old value is what is expected, otherwise reads the old value
      (function)[edit]
      atomic addition
      (function)[edit]
      atomic subtraction
      (function)[edit]
      atomic bitwise OR
      (function)[edit]
      atomic bitwise exclusive OR
      (function)[edit]
      atomic bitwise AND
      (function)[edit]
      generic memory order-dependent fence synchronization primitive
      (function)[edit]
      fence between a thread and a signal handler executed in the same thread
      (function)[edit]

      [edit]Types

      The standard library offers convenience typedefs for thecore language atomic types.

      Typedef name Full type name
      atomic_bool_Atomic _Bool
      atomic_char_Atomicchar
      atomic_schar_Atomicsignedchar
      atomic_uchar_Atomicunsignedchar
      atomic_short_Atomicshort
      atomic_ushort_Atomicunsignedshort
      atomic_int_Atomicint
      atomic_uint_Atomicunsignedint
      atomic_long_Atomiclong
      atomic_ulong_Atomicunsignedlong
      atomic_llong_Atomiclonglong
      atomic_ullong_Atomicunsignedlonglong
      atomic_char8_t(C23)_Atomic char8_t
      atomic_char16_t_Atomic char16_t
      atomic_char32_t_Atomic char32_t
      atomic_wchar_t_Atomicwchar_t
      atomic_int_least8_t_Atomicint_least8_t
      atomic_uint_least8_t_Atomicuint_least8_t
      atomic_int_least16_t_Atomicint_least16_t
      atomic_uint_least16_t_Atomicuint_least16_t
      atomic_int_least32_t_Atomicint_least32_t
      atomic_uint_least32_t_Atomicuint_least32_t
      atomic_int_least64_t_Atomicint_least64_t
      atomic_uint_least64_t_Atomicuint_least64_t
      atomic_int_fast8_t_Atomicint_fast8_t
      atomic_uint_fast8_t_Atomicuint_fast8_t
      atomic_int_fast16_t_Atomicint_fast16_t
      atomic_uint_fast16_t_Atomicuint_fast16_t
      atomic_int_fast32_t_Atomicint_fast32_t
      atomic_uint_fast32_t_Atomicuint_fast32_t
      atomic_int_fast64_t_Atomicint_fast64_t
      atomic_uint_fast64_t_Atomicuint_fast64_t
      atomic_intptr_t_Atomicintptr_t
      atomic_uintptr_t_Atomicuintptr_t
      atomic_size_t_Atomicsize_t
      atomic_ptrdiff_t_Atomicptrdiff_t
      atomic_intmax_t_Atomicintmax_t
      atomic_uintmax_t_Atomicuintmax_t

      [edit]References

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

      [edit]See also

      C++ documentation forAtomic operations library
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/atomic&oldid=156654"

      [8]ページ先頭

      ©2009-2025 Movatter.jp