stdatomic.ch

Declarations

Public Only
Publicstruct atomic_flag
struct atomic_flag
TODO atomic_flag is implementation defined 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.
Publicenum memory_order
enum memory_order { relaxed, seq_cst, consume, acquire, release, acq_rel }
memory_order specifies how memory accesses, including regular, non-atomic memory accesses, are to be ordered around an atomic operation. Absent any constraints on a multi-core system, when multiple threads simultaneously read and write to several variables, one thread can observe the values change in an order different from the order another thread wrote them. Indeed, the apparent order of changes can even differ among multiple reader threads. Some similar effects can occur even on uniprocessor systems due to compiler transformations allowed by the memory model. The default behavior of all atomic operations in the language and the library provides for sequentially consistent ordering (see discussion below). That default can hurt performance, but the library's atomic operations can be given an additional memory_order argument to specify the exact constraints, beyond atomicity, that the compiler and processor must enforce for that operation. TODO implementation values should be verified to match

See Also

  • https:en.cppreference.com/w/c/atomic/memory_order
Publicstruct atomic
struct atomic<T>
TODO atomic type is C++ implementation defined
Publicfunction atomic_is_lock_free
func atomic_is_lock_free<A>(obj : *atomic<>) : bool
Determines if the atomic operations on all objects of the type A (the type of the object pointed to by obj) are lock-free. In any given program execution, the result of calling atomic_is_lock_free is the same for all pointers of the same type. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_is_lock_free)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to inspect @return true if the operations on all objects of the type A are lock-free, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_is_lock_free

Returns

true if the operations on all objects of the type A are lock-free, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_is_lock_free

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_is_lock_free
Publicfunction atomic_store
func atomic_store<A, C>(obj : *atomic<>, desired : atomic<>) : void
Atomically replaces the value of the atomic variable pointed to by obj with desired. The operation is atomic write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. order must be one of memory_order_relaxed, memory_order_release or memory_order_seq_cst. Otherwise the behavior is undefined. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. C is the non-atomic type corresponding to A. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_store)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj - pointer to the atomic object to modify @see https:en.cppreference.com/w/c/atomic/atomic_store

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_store
Publicfunction atomic_store_explicit
func atomic_store_explicit<A, C>(obj : *atomic<>, desired : atomic<>, order : memory_order) : void
Atomically replaces the value of the atomic variable pointed to by obj with desired. The operation is atomic write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. order must be one of memory_order_relaxed, memory_order_release or memory_order_seq_cst. Otherwise the behavior is undefined. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. C is the non-atomic type corresponding to A. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_store)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj - pointer to the atomic object to modify @param order - the memory synchronization ordering for this operation @see https:en.cppreference.com/w/c/atomic/atomic_store
  • order - the memory synchronization ordering for this operation @see https:en.cppreference.com/w/c/atomic/atomic_store

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_store
Publicfunction atomic_load
func atomic_load<A, C>(obj : *atomic<>) :
Atomically loads and returns the current value of the atomic variable pointed to by obj. The operation is atomic read operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. order must be one of memory_order_relaxed, memory_order_consume, memory_order_acquire or memory_order_seq_cst. Otherwise the behavior is undefined. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. C is the non-atomic type corresponding to A. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_load)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to access @return The current value of the atomic variable pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_load

Returns

The current value of the atomic variable pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_load

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_load
Publicfunction atomic_load_explicit
func atomic_load_explicit<A, C>(obj : *atomic<>, order : memory_order) : atomic<>
Atomically loads and returns the current value of the atomic variable pointed to by obj. The operation is atomic read operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. order must be one of memory_order_relaxed, memory_order_consume, memory_order_acquire or memory_order_seq_cst. Otherwise the behavior is undefined. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. C is the non-atomic type corresponding to A. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_load)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to access @param order - the memory synchronization ordering for this operation @return The current value of the atomic variable pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_load
  • order - the memory synchronization ordering for this operation @return The current value of the atomic variable pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_load

Returns

The current value of the atomic variable pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_load

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_load
Publicfunction atomic_exchange
func atomic_exchange<A, C>(obj : *atomic<>, desired : atomic<>) : atomic<>
Atomically replaces the value pointed by obj with desired and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. C is the non-atomic type corresponding to A. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_exchange)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined..

Parameters

  • obj (volatile) - pointer to the atomic object to modify @param desired - the value to replace the atomic object with @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_exchange
  • desired - the value to replace the atomic object with @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_exchange
  • order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_exchange

Returns

The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_exchange

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_exchange
Publicfunction atomic_exchange_explicit
func atomic_exchange_explicit<A, C>(obj : *atomic<>, desired : atomic<>, order : memory_order) : atomic<>
Atomically replaces the value pointed by obj with desired and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. C is the non-atomic type corresponding to A. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_exchange)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined..

Parameters

  • obj (volatile) - pointer to the atomic object to modify @param desired - the value to replace the atomic object with @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_exchange
  • desired - the value to replace the atomic object with @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_exchange
  • order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_exchange

Returns

The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_exchange

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_exchange
Publicfunction atomic_compare_exchange_strong
func atomic_compare_exchange_strong<A, C>(obj : *atomic<>, expected : *atomic<>, desired : atomic<>) : bool
Atomically compares the contents of memory pointed to by obj with the contents of memory pointed to by expected, and if those are bitwise equal, replaces the former with desired (performs read-modify-write operation). Otherwise, loads the actual contents of memory pointed to by obj into *expected (performs load operation). The memory models for the read-modify-write and load operations are succ and fail respectively. The (1-2) versions use memory_order_seq_cst by default. The weak forms ((2) and (4)) of the functions are allowed to fail spuriously, that is, act as if *obj != *expected even if they are equal. When a compare-and-exchange is in a loop, the weak version will yield better performance on some platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the strong one is preferable. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. C is the non-atomic type corresponding to A. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_compare_exchange)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to test and modify @param expected - pointer to the value expected to be found in the atomic object @param desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • expected - pointer to the value expected to be found in the atomic object @param desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange

Returns

The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
Publicfunction atomic_compare_exchange_weak
func atomic_compare_exchange_weak<A, C>(obj : *atomic<>, expected : *atomic<>, desired : atomic<>) : bool
Atomically compares the contents of memory pointed to by obj with the contents of memory pointed to by expected, and if those are bitwise equal, replaces the former with desired (performs read-modify-write operation). Otherwise, loads the actual contents of memory pointed to by obj into *expected (performs load operation). The memory models for the read-modify-write and load operations are succ and fail respectively. The (1-2) versions use memory_order_seq_cst by default. The weak forms ((2) and (4)) of the functions are allowed to fail spuriously, that is, act as if *obj != *expected even if they are equal. When a compare-and-exchange is in a loop, the weak version will yield better performance on some platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the strong one is preferable. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. C is the non-atomic type corresponding to A. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_compare_exchange)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to test and modify @param expected - pointer to the value expected to be found in the atomic object @param desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • expected - pointer to the value expected to be found in the atomic object @param desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange

Returns

The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
Publicfunction atomic_compare_exchange_strong_explicit
func atomic_compare_exchange_strong_explicit<A, C>(obj : *atomic<>, expected : *atomic<>, desired : atomic<>, succ : memory_order, fail : memory_order) : void
Atomically compares the contents of memory pointed to by obj with the contents of memory pointed to by expected, and if those are bitwise equal, replaces the former with desired (performs read-modify-write operation). Otherwise, loads the actual contents of memory pointed to by obj into *expected (performs load operation). The memory models for the read-modify-write and load operations are succ and fail respectively. The (1-2) versions use memory_order_seq_cst by default. The weak forms ((2) and (4)) of the functions are allowed to fail spuriously, that is, act as if *obj != *expected even if they are equal. When a compare-and-exchange is in a loop, the weak version will yield better performance on some platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the strong one is preferable. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. C is the non-atomic type corresponding to A. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_compare_exchange)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to test and modify @param expected - pointer to the value expected to be found in the atomic object @param desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • expected - pointer to the value expected to be found in the atomic object @param desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange

Returns

The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
Publicfunction atomic_compare_exchange_weak_explicit
func atomic_compare_exchange_weak_explicit<A, C>(obj : *atomic<>, expected : *atomic<>, desired : atomic<>, succ : memory_order, fail : memory_order) : bool
Atomically compares the contents of memory pointed to by obj with the contents of memory pointed to by expected, and if those are bitwise equal, replaces the former with desired (performs read-modify-write operation). Otherwise, loads the actual contents of memory pointed to by obj into *expected (performs load operation). The memory models for the read-modify-write and load operations are succ and fail respectively. The (1-2) versions use memory_order_seq_cst by default. The weak forms ((2) and (4)) of the functions are allowed to fail spuriously, that is, act as if *obj != *expected even if they are equal. When a compare-and-exchange is in a loop, the weak version will yield better performance on some platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the strong one is preferable. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. C is the non-atomic type corresponding to A. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_compare_exchange)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to test and modify @param expected - pointer to the value expected to be found in the atomic object @param desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • expected - pointer to the value expected to be found in the atomic object @param desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • desired - the value to store in the atomic object if it is as expected @param succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • succ - the memory synchronization ordering for the read-modify-write operation if the comparison succeeds. All values are permitted. @param fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
  • fail - the memory synchronization ordering for the load operation if the comparison fails. Cannot be memory_order_release or memory_order_acq_rel and cannot specify stronger ordering than succ @return The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange

Returns

The result of the comparison: true if *obj was equal to *exp, false otherwise. @see https:en.cppreference.com/w/c/atomic/atomic_compare_exchange

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_compare_exchange
Publicfunction atomic_fetch_add
func atomic_fetch_add<A, M, C>(obj : *atomic<>, arg : atomic<>) : atomic<>
Atomically replaces the value pointed by obj with the result of addition of arg to the old value of obj, and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. M is either the non-atomic type corresponding to A if A is atomic integer type, or ptrdiff_t if A is atomic pointer type. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_fetch_add)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined. For signed integer types, arithmetic is defined to use two’s complement representation. There are no undefined results. For pointer types, the result may be an undefined address, but the operations otherwise have no undefined behavior.

Parameters

  • obj - pointer to the atomic object to modify @param arg - the value to add to the value stored in the atomic object @return The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_add
  • arg - the value to add to the value stored in the atomic object @return The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_add

Returns

The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_add

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_fetch_add
Publicfunction atomic_fetch_add_explicit
func atomic_fetch_add_explicit<A, M, C>(obj : *atomic<>, arg : atomic<>, order : memory_order) : atomic<>
Atomically replaces the value pointed by obj with the result of addition of arg to the old value of obj, and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. M is either the non-atomic type corresponding to A if A is atomic integer type, or ptrdiff_t if A is atomic pointer type. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_fetch_add)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined. For signed integer types, arithmetic is defined to use two’s complement representation. There are no undefined results. For pointer types, the result may be an undefined address, but the operations otherwise have no undefined behavior.

Parameters

  • obj - pointer to the atomic object to modify @param arg - the value to add to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_add
  • arg - the value to add to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_add
  • order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_add

Returns

The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_add

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_fetch_add
Publicfunction atomic_fetch_sub
func atomic_fetch_sub<A, M, C>(obj : *atomic<>, arg : atomic<>) : atomic<>
Atomically replaces the value pointed by obj with the result of subtraction of arg from the old value of obj, and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. M is either the non-atomic type corresponding to A if A is atomic integer type, or ptrdiff_t if A is atomic pointer type. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_fetch_sub)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined. For signed integer types, arithmetic is defined to use two’s complement representation. There are no undefined results. For pointer types, the result may be an undefined address, but the operations otherwise have no undefined behavior.

Parameters

  • obj (volatile) - pointer to the atomic object to modify @param arg - the value to subtract from the value stored in the atomic object @return The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_sub
  • arg - the value to subtract from the value stored in the atomic object @return The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_sub

Returns

The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_sub

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_fetch_sub
Publicfunction atomic_fetch_sub_explicit
func atomic_fetch_sub_explicit<A, M, C>(obj : *atomic<>, arg : atomic<>, order : memory_order) : atomic<>
Atomically replaces the value pointed by obj with the result of subtraction of arg from the old value of obj, and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. M is either the non-atomic type corresponding to A if A is atomic integer type, or ptrdiff_t if A is atomic pointer type. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_fetch_sub)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined. For signed integer types, arithmetic is defined to use two’s complement representation. There are no undefined results. For pointer types, the result may be an undefined address, but the operations otherwise have no undefined behavior.

Parameters

  • obj (volatile) - pointer to the atomic object to modify @param arg - the value to subtract from the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_sub
  • arg - the value to subtract from the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_sub
  • order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_sub

Returns

The value held previously by the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_sub

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_fetch_sub
Publicfunction atomic_fetch_or
func atomic_fetch_or<A, M, C>(obj : *atomic<>, arg : atomic<>) : atomic<>
Atomically replaces the value pointed by obj with the result of bitwise OR between the old value of obj and arg, and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. M is either the non-atomic type corresponding to A if A is atomic integer type, or ptrdiff_t if A is atomic pointer type. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_fetch_or)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to modify @param arg - the value to bitwise OR to the value stored in the atomic object @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_or
  • arg - the value to bitwise OR to the value stored in the atomic object @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_or

Returns

The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_or

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_fetch_or
Publicfunction atomic_fetch_or_explicit
func atomic_fetch_or_explicit<A, M, C>(obj : *atomic<>, arg : atomic<>, order : memory_order) : atomic<>
Atomically replaces the value pointed by obj with the result of bitwise OR between the old value of obj and arg, and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. M is either the non-atomic type corresponding to A if A is atomic integer type, or ptrdiff_t if A is atomic pointer type. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_fetch_or)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to modify @param arg - the value to bitwise OR to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_or
  • arg - the value to bitwise OR to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_or
  • order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_or

Returns

The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_or

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_fetch_or
Publicfunction atomic_fetch_xor
func atomic_fetch_xor<A, M, C>(obj : *atomic<>, arg : atomic<>) : atomic<>
Atomically replaces the value pointed by obj with the result of bitwise XOR between the old value of obj and arg, and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. M is either the non-atomic type corresponding to A if A is atomic integer type, or ptrdiff_t if A is atomic pointer type. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_fetch_xor)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to modify @param arg - the value to bitwise XOR to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_xor
  • arg - the value to bitwise XOR to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_xor
  • order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_xor

Returns

The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_xor

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_fetch_xor
Publicfunction atomic_fetch_xor_explicit
func atomic_fetch_xor_explicit<A, M, C>(obj : *atomic<>, arg : atomic<>, order : memory_order) : atomic<>
Atomically replaces the value pointed by obj with the result of bitwise XOR between the old value of obj and arg, and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. M is either the non-atomic type corresponding to A if A is atomic integer type, or ptrdiff_t if A is atomic pointer type. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_fetch_xor)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to modify @param arg - the value to bitwise XOR to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_xor
  • arg - the value to bitwise XOR to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_xor
  • order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_xor

Returns

The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_xor

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_fetch_xor
Publicfunction atomic_fetch_and
func atomic_fetch_and<A, M, C>(obj : *atomic<>, arg : atomic<>) : atomic<>
Atomically replaces the value pointed by obj with the result of bitwise AND between the old value of obj and arg, and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. M is either the non-atomic type corresponding to A if A is atomic integer type, or ptrdiff_t if A is atomic pointer type. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_fetch_and)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to modify @param arg - the value to bitwise AND to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_and
  • arg - the value to bitwise AND to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_and
  • order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_and

Returns

The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_and

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_fetch_and
Publicfunction atomic_fetch_and_explicit
func atomic_fetch_and_explicit<A, M, C>(obj : *atomic<>, arg : atomic<>, order : memory_order) : atomic<>
Atomically replaces the value pointed by obj with the result of bitwise AND between the old value of obj and arg, and returns the value obj held previously. The operation is read-modify-write operation. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. M is either the non-atomic type corresponding to A if A is atomic integer type, or ptrdiff_t if A is atomic pointer type. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_fetch_and)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj (volatile) - pointer to the atomic object to modify @param arg - the value to bitwise AND to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_and
  • arg - the value to bitwise AND to the value stored in the atomic object @param order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_and
  • order - the memory synchronization ordering for this operation: all values are permitted @return The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_and

Returns

The value held previously be the atomic object pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_fetch_and

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_fetch_and
Publicfunction atomic_flag_test_and_set
func atomic_flag_test_and_set(obj : *atomic_flag) : bool
Atomically changes the state of a atomic_flag pointed to by obj to set (true) and returns the previous value. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. The argument is pointer to a volatile atomic flag to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic flags.

Parameters

  • obj (volatile) - pointer to the atomic flag object to modify @param order - the memory synchronization ordering for this operation: all values are permitted @return The previous value held by the atomic flag pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_flag_test_and_set
  • order - the memory synchronization ordering for this operation: all values are permitted @return The previous value held by the atomic flag pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_flag_test_and_set

Returns

The previous value held by the atomic flag pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_flag_test_and_set

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_flag_test_and_set
Publicfunction atomic_flag_test_and_set_explicit
func atomic_flag_test_and_set_explicit(obj : *atomic_flag, order : memory_order) : bool
Atomically changes the state of a atomic_flag pointed to by obj to set (true) and returns the previous value. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. The argument is pointer to a volatile atomic flag to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic flags.

Parameters

  • obj (volatile) - pointer to the atomic flag object to modify @param order - the memory synchronization ordering for this operation: all values are permitted @return The previous value held by the atomic flag pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_flag_test_and_set
  • order - the memory synchronization ordering for this operation: all values are permitted @return The previous value held by the atomic flag pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_flag_test_and_set

Returns

The previous value held by the atomic flag pointed to by obj. @see https:en.cppreference.com/w/c/atomic/atomic_flag_test_and_set

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_flag_test_and_set
Publicfunction atomic_flag_clear
func atomic_flag_clear(obj : *atomic_flag) : void
Atomically changes the state of a atomic_flag pointed to by obj to clear (false). The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. The argument is pointer to a volatile atomic flag to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic flags.

Parameters

  • obj (volatile) - pointer to the atomic flag object to modify @param order - the memory synchronization ordering for this operation: all values are permitted @see https:en.cppreference.com/w/c/atomic/atomic_flag_clear
  • order - the memory synchronization ordering for this operation: all values are permitted @see https:en.cppreference.com/w/c/atomic/atomic_flag_clear

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_flag_clear
Publicfunction atomic_flag_clear_explicit
func atomic_flag_clear_explicit(obj : *atomic_flag, order : memory_order) : void
Atomically changes the state of a atomic_flag pointed to by obj to clear (false). The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order. The argument is pointer to a volatile atomic flag to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic flags.

Parameters

  • obj (volatile) - pointer to the atomic flag object to modify @param order - the memory synchronization ordering for this operation: all values are permitted @see https:en.cppreference.com/w/c/atomic/atomic_flag_clear
  • order - the memory synchronization ordering for this operation: all values are permitted @see https:en.cppreference.com/w/c/atomic/atomic_flag_clear

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_flag_clear
Publicfunction atomic_init
func atomic_init<A, C>(obj : *atomic<>, desired : atomic<>) : void
Initializes the default-constructed atomic object obj with the value desired. The function is not atomic: concurrent access from another thread, even through an atomic operation, is a data race. This is a generic function defined for all atomic object types A. The argument is pointer to a volatile atomic type to accept addresses of both non-volatile and volatile (e.g. memory-mapped I/O) atomic objects, and volatile semantic is preserved when applying this operation to volatile atomic objects. C is the non-atomic type corresponding to A. It is unspecified whether the name of a generic function is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function (e.g. parenthesized like (atomic_init)(...)), or a program defines an external identifier with the name of a generic function, the behavior is undefined.

Parameters

  • obj - pointer to an atomic object to initialize @param desired - the value to initialize atomic object with @see https:en.cppreference.com/w/c/atomic/atomic_init
  • desired - the value to initialize atomic object with @see https:en.cppreference.com/w/c/atomic/atomic_init

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_init
Publicfunction kill_dependency
func kill_dependency<A>(y : atomic<>) : atomic<>
Informs the compiler that the dependency tree started by an memory_order_consume atomic load operation does not extend past the return value of kill_dependency; that is, the argument does not carry a dependency into the return value. The function is implemented as a macro. A is the type of y.

Parameters

  • y - the expression whose return value is to be removed from a dependency tree @return Returns y, no longer a part of a dependency tree. @see https:en.cppreference.com/w/c/atomic/kill_dependency

Returns

Returns y, no longer a part of a dependency tree. @see https:en.cppreference.com/w/c/atomic/kill_dependency

See Also

  • https:en.cppreference.com/w/c/atomic/kill_dependency
Publicfunction atomic_thread_fence
func atomic_thread_fence(order : memory_order) : void
Establishes memory synchronization ordering of non-atomic and relaxed atomic accesses, as instructed by order, without an associated atomic operation. For example, all non-atomic and relaxed atomic stores that happen before a memory_order_release fence in thread A will be synchronized with non-atomic and relaxed atomic loads from the same locations made in thread B after an memory_order_acquire fence.

Parameters

  • order - the memory ordering executed by this fence @see https:en.cppreference.com/w/c/atomic/atomic_thread_fence

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_thread_fence
Publicfunction atomic_signal_fence
func atomic_signal_fence(order : memory_order) : void
Establishes memory synchronization ordering of non-atomic and relaxed atomic accesses, as instructed by order, between a thread and a signal handler executed on the same thread. This is equivalent to atomic_thread_fence, except no CPU instructions for memory ordering are issued. Only reordering of the instructions by the compiler is suppressed as order instructs. For example, a fence with release semantics prevents reads or writes from being moved past subsequent writes and a fence with acquire semantics prevents reads or writes from being moved ahead of preceding reads.

Parameters

  • order - the memory ordering executed by this fence @see https:en.cppreference.com/w/c/atomic/atomic_signal_fence

See Also

  • https:en.cppreference.com/w/c/atomic/atomic_signal_fence