|
Lely core libraries 1.9.2
|
This header file is part of the C11 and POSIX compatibility library; it includes <stdatomic.h>, if it exists, and defines any missing functionality.
More...


Go to the source code of this file.
Data Structures | |
| struct | atomic_flag |
| An atomic type providing the classic test-and-set functionality. More... | |
Macros | |
| #define | ATOMIC_FLAG_INIT |
| The static initializer used to initialize an atomic_flag to the clear state. | |
| #define | ATOMIC_VAR_INIT(value) |
| The static initializer for an atomic object of a type that is initialization-compatible with value. | |
| #define | atomic_init(obj, value) atomic_store_explicit(obj, value, memory_order_relaxed) |
| Initializes the atomic object at obj with the value value. | |
| #define | kill_dependency(y) |
| Terminates a dependency chain; the argument does not carry a dependency to the return value. | |
| #define | atomic_is_lock_free(obj) (sizeof((obj)->_value_) <= sizeof(void *)) |
| Indicates the lock-free property of integer and address atomic types. | |
| #define | atomic_store(object, desired) (atomic_store_explicit((object), (desired), memory_order_seq_cst)) |
| Equivalent to atomic_store_explicit(object, desired, memory_order_seq_cst). | |
| #define | atomic_store_explicit(object, desired, order) ((void)atomic_exchange_explicit((object), (desired), (order))) |
| Atomically replaces the value at object with the value of desired. | |
| #define | atomic_load(object) (atomic_load_explicit((object), memory_order_seq_cst)) |
| Equivalent to #atomic_load_explicit(object, memory_order_seq_cst). | |
| #define | atomic_exchange(object, desired) (atomic_exchange_explicit((object), (desired), memory_order_seq_cst)) |
| Atomically returns the value at object. | |
| #define | atomic_compare_exchange_strong(object, expected, desired) |
| Atomically replaces the value at object with desired. | |
| #define | atomic_compare_exchange_weak(object, expected, desired) |
| Atomically compares the value at object for equality with that at expected, and if true, replaces the value at object with desired, and if false, updates the value at expected with the value at object. | |
| #define | atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) |
| Equivalent to atomic_compare_exchange_strong_explicit(), except that a weak compare-and-exchange may fail spuriously. | |
| #define | atomic_fetch_add(object, operand) (atomic_fetch_add_explicit((object), (operand), memory_order_seq_cst)) |
| Equivalent to #atomic_fetch_add_explicit(object, operand,
memory_order_seq_cst). | |
| #define | atomic_fetch_sub(object, operand) (atomic_fetch_sub_explicit((object), (operand), memory_order_seq_cst)) |
Atomically replaces the value at object with *object + operand. | |
| #define | atomic_fetch_or(object, operand) (atomic_fetch_or_explicit((object), (operand), memory_order_seq_cst)) |
Atomically replaces the value at object with *object - operand. | |
| #define | atomic_fetch_xor(object, operand) (atomic_fetch_xor_explicit((object), (operand), memory_order_seq_cst)) |
Atomically replaces the value at object with *object | operand. | |
| #define | atomic_fetch_and(object, operand) (atomic_fetch_and_explicit((object), (operand), memory_order_seq_cst)) |
Atomically replaces the value at object with *object ^ operand. | |
Enumerations | |
| enum | memory_order { memory_order_relaxed = 0 , memory_order_consume = 1 , memory_order_acquire = 2 , memory_order_release = 3 , memory_order_acq_rel = 4 , memory_order_seq_cst = 5 } |
| An enumerated type identifying memory constraints. More... | |
Functions | |
| void | atomic_thread_fence (memory_order order) |
| Inserts a fence with semantics according to order. | |
| void | atomic_signal_fence (memory_order order) |
Equivalent to atomic_thread_fence(order), except that the resulting ordering constraints are established only between a thread and a signal handler executing in the same thread. | |
| ATOMIC_BOOL_TYPE | atomic_flag_test_and_set_explicit (volatile atomic_flag *object, memory_order order) |
Atomically replaces the value at object with *object & operand. | |
| ATOMIC_BOOL_TYPE | atomic_flag_test_and_set (volatile atomic_flag *object) |
| Equivalent to #atomic_flag_test_and_set_explicit(object,
memory_order_seq_cst). | |
| void | atomic_flag_clear_explicit (volatile atomic_flag *object, memory_order order) |
| Atomically sets the value at object to false. | |
| void | atomic_flag_clear (volatile atomic_flag *object) |
| Equivalent to #atomic_flag_test_and_set_explicit(object,
memory_order_seq_cst). | |
This header file is part of the C11 and POSIX compatibility library; it includes <stdatomic.h>, if it exists, and defines any missing functionality.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file stdatomic.h.
| #define atomic_init | ( | obj, | |
| value | |||
| ) | atomic_store_explicit(obj, value, memory_order_relaxed) |
Initializes the atomic object at obj with the value value.
Note that this function does not avoid data races.
Definition at line 221 of file stdatomic.h.
| #define atomic_is_lock_free | ( | obj | ) | (sizeof((obj)->_value_) <= sizeof(void *)) |
Indicates the lock-free property of integer and address atomic types.
Definition at line 269 of file stdatomic.h.
| #define atomic_store_explicit | ( | object, | |
| desired, | |||
| order | |||
| ) | ((void)atomic_exchange_explicit((object), (desired), (order))) |
Atomically replaces the value at object with the value of desired.
Memory is affected according to order.
Definition at line 327 of file stdatomic.h.
| #define atomic_exchange | ( | object, | |
| desired | |||
| ) | (atomic_exchange_explicit((object), (desired), memory_order_seq_cst)) |
Atomically returns the value at object.
Memory is affected according to order. Equivalent to #atomic_exchange_explicit(object, desired, memory_order_seq_cst).
Definition at line 354 of file stdatomic.h.
| #define atomic_compare_exchange_strong | ( | object, | |
| expected, | |||
| desired | |||
| ) |
Atomically replaces the value at object with desired.
Memory is affected according to order.
Definition at line 383 of file stdatomic.h.
| #define atomic_compare_exchange_weak | ( | object, | |
| expected, | |||
| desired | |||
| ) |
Atomically compares the value at object for equality with that at expected, and if true, replaces the value at object with desired, and if false, updates the value at expected with the value at object.
Further, if the comparison is true, memory is affected according to the value of success, and if the comparison is false, memory is affected according to the value of failure.
Definition at line 427 of file stdatomic.h.
| #define atomic_compare_exchange_weak_explicit | ( | object, | |
| expected, | |||
| desired, | |||
| success, | |||
| failure | |||
| ) |
Equivalent to atomic_compare_exchange_strong_explicit(), except that a weak compare-and-exchange may fail spuriously.
That is, even when the contents of memory referred to by expected and object are equal, it may return zero and store back to expected the same memory contents that were there before.
The spurious failure enables implementation of compare-and-exchange on a broader class of machines. 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.
Definition at line 456 of file stdatomic.h.
| #define atomic_fetch_sub | ( | object, | |
| operand | |||
| ) | (atomic_fetch_sub_explicit((object), (operand), memory_order_seq_cst)) |
Atomically replaces the value at object with *object + operand.
Memory is affected according to order.
Definition at line 490 of file stdatomic.h.
| #define atomic_fetch_or | ( | object, | |
| operand | |||
| ) | (atomic_fetch_or_explicit((object), (operand), memory_order_seq_cst)) |
Atomically replaces the value at object with *object - operand.
Memory is affected according to order.
Definition at line 514 of file stdatomic.h.
| #define atomic_fetch_xor | ( | object, | |
| operand | |||
| ) | (atomic_fetch_xor_explicit((object), (operand), memory_order_seq_cst)) |
Atomically replaces the value at object with *object | operand.
Memory is affected according to order.
Definition at line 538 of file stdatomic.h.
| #define atomic_fetch_and | ( | object, | |
| operand | |||
| ) | (atomic_fetch_and_explicit((object), (operand), memory_order_seq_cst)) |
Atomically replaces the value at object with *object ^ operand.
Memory is affected according to order.
Definition at line 562 of file stdatomic.h.
| enum memory_order |
An enumerated type identifying memory constraints.
Definition at line 128 of file stdatomic.h.
|
inline |
Atomically replaces the value at object with *object & operand.
Memory is affected according to order.
Definition at line 642 of file stdatomic.h.
|
inline |
Atomically sets the value at object to false.
Memory is affected according to order.
Definition at line 655 of file stdatomic.h.