P99
|
Set a flag and notify other threads that an event has occurred. More...
#include <p99_notifier.h>
Related Functions | |
(Note that these are not member functions.) | |
void | p99_notifier_block (p99_notifier volatile *p00_n, unsigned p00_v) |
Block until the notification flag has been set to the indicated value. More... | |
void | p99_notifier_destroy (p99_notifier *p00_n) |
destroy a notifier More... | |
p99_notifier * | p99_notifier_init (p99_notifier *p00_n, unsigned p00_v) |
Initialize a notifier to value p00_v. More... | |
unsigned | p99_notifier_load (p99_notifier volatile *p00_n) |
Return the value of the notifier. Non blocking. More... | |
Set a flag and notify other threads that an event has occurred.
Such a variable stores a state and enables threads to wait for a certain value of that state.
Per default, the state space that is used are just the values 0
and 1
but other values that are compatible with unsigned
or int
, e.g enumeration types, could be used as well.
The state with value 0
is special and should not be waited for.
A typical example could be a herd of threads. Let us suppose that we have a main thread that launches such a herd:
Then every thread should just block on that notifier at the beginning of its function
Definition at line 76 of file p99_notifier.h.