P99
Related Functions

The "minimal" type for which atomic operations must be defined. More...

#include <p99_atomic.h>

Related Functions

(Note that these are not member functions.)

#define atomic_flag_clear(OBJ)   p00_sync_lock_release(&P99_ENCP(OBJ))
 Unconditionally set *p00_objp to false. More...
 
#define atomic_flag_clear_explicit(OBJ, ORD)   p00_sync_lock_release(&P99_ENCP(OBJ), (ORD))
 Unconditionally set *p00_objp to false. More...
 
void atomic_flag_lock (volatile atomic_flag *p00_objp)
 extension: spin on p00_objp setting the flag until the state before was "clear" More...
 
#define atomic_flag_test_and_set(OBJ)   p00_sync_lock_test_and_set(&P99_ENCP(OBJ))
 Unconditionally set OBJ to true and return the previous value. More...
 
#define atomic_flag_test_and_set_explicit(OBJ, ORD)   p00_sync_lock_test_and_set(&P99_ENCP(OBJ), (ORD))
 Unconditionally set *object to true and return the previous value. More...
 
_Bool atomic_flag_trylock (volatile atomic_flag *p00_objp)
 extension: set the flag and return true if we are the first to do so More...
 
void atomic_flag_unlock (volatile atomic_flag *p00_objp)
 extension: clear the flag unconditionally More...
 

Detailed Description

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.

Remarks
encapsulates an object of type p00_atomic_flag
See also
P99_ENC for access through object
P99_ENCP for access through pointer
Examples:
test-p99-pow.c.

Definition at line 564 of file p99_atomic.h.


The documentation for this struct was generated from the following files: