|
P99
|
The "minimal" type for which atomic operations must be defined. More...
#include <p99_atomic.h>
Public Member Functions | |
| void | atomic_flag_clear (volatile atomic_flag *p00_objp) |
Unconditionally set *p00_objp to false. | |
| void | atomic_flag_clear_explicit (volatile atomic_flag *p00_objp, memory_order p00_ord) |
Unconditionally set *p00_objp to false. | |
| #define | ATOMIC_FLAG_INIT P99_ENC_INIT(0) |
| Initialize a variable of type atomic_flag. | |
| void | atomic_flag_lock (volatile atomic_flag *p00_objp) |
| extension: spin on p00_objp setting the flag until the state before was "clear" | |
| _Bool | atomic_flag_test_and_set (volatile atomic_flag *p00_objp) |
Unconditionally set *object to true and return the previous value. | |
| _Bool | atomic_flag_test_and_set_explicit (volatile atomic_flag *p00_objp, memory_order p00_ord) |
Unconditionally set *object to true and return the previous value. | |
| _Bool | atomic_flag_trylock (volatile atomic_flag *p00_objp) |
| extension: set the flag and return true if we are the first to do so | |
| void | atomic_flag_unlock (volatile atomic_flag *p00_objp) |
| extension: clear the flag unconditionally | |
The "minimal" type for which atomic operations must be defined.
This only has very basic operations that can set and clear the flag. In particular it has no operation that returns the state of the flag and that would not modify it eventually. So this is a kind of Heisenberg flag, you can't measure it without modifying it. This can be used as a spinlock to force the flag to be set, perform a desired operation and then clear the flag, again.
There are extensions atomic_flag_lock, atomic_flag_trylock and atomic_flag_unlock that perform these spinlock type operations with only the necessary memory consistency.
Definition at line 513 of file p99_atomic.h.
1.7.6.1