![]() |
The Gate provides a queued synchronization access control. More...
#include <Gate.h>
Public Member Functions | |
Gate (bool pShared=false) | |
Creates a "gate" synchronization primitive. | |
~Gate () | |
void | signal () |
Send a "signal" for the first enqueued thread to pass the Gate. | |
void | wait () |
Waits until a signal is received and the calling thread is the first on the queued waiting list. | |
The Gate provides a queued synchronization access control.
When more than one thread wait for a signal, the Gate will freeze each thread until a signal is sent to the Gate, and the first thread enqueued waiting for attention will pass, letting the others waiting for the next signal.
The Gate is different to a Dam, because in the Gate case, only one thread is letting to pass at a time, while in the Dam all them are let free in the same instant in time.
The C++11 condition_variable is not used because its definition is not complete (we need multi-process gates) so, the POSIX one takes its place.
HSEP::Gate::Gate | ( | bool | pShared = false | ) |
void HSEP::Gate::signal | ( | ) |
void HSEP::Gate::wait | ( | ) |