![]() |
PIP 5.5.3
Platform-Independent Primitives
|
Class for simple notify and wait in different threads. More...
#include <pithreadnotifier.h>
Public Member Functions | |
| void | wait () |
| Start waiting, return if other thread call notify() More... | |
| bool | waitFor (PISystemTime timeout) |
| Start waiting no longer than "timeout", return true if other thread call notify(), false if timeout expired. | |
| void | notify () |
| Notify one waiting thread, which waiting on wait() function. More... | |
Class for simple notify and wait in different threads.
This class used as event mechanism between threads. One thread wait for some event, and another send this event, unblocking first thread. It is useful to syncronize some actions in several threads.
| void PIThreadNotifier::wait | ( | ) |
Start waiting, return if other thread call notify()
If notify() has been called before, then returns immediately.
If notify() has been called "n" times, then returns immediately "n" times, but only if wait in one thread.
If many threads waiting, then if notify() has been called "n" times, all threads total returns "n" times in undefined sequence.
| void PIThreadNotifier::notify | ( | ) |
Notify one waiting thread, which waiting on wait() function.
If many threads waiting, then notify randomly one.
If call this "n" times, then notify any waiting threads totally "n" times.