![]() |
Defines a synchronization primitive that blocks any thread that call the wait method if the internal state for the primitive is "closed" and let them pass when the state becomes "open". More...
#include <Dam.h>
Public Member Functions | |
Dam (bool pState=CLOSED, bool pShared=false) | |
Creates a synchronization Dam whose default state is closed. | |
virtual | ~Dam () |
void | wait () |
Wait until the Dam is opened. | |
void | open () |
Open the Dam, making any waiting "wait" to be completed. | |
void | close () |
Close the Dam. | |
bool | isOpen () |
Indicates if the dam is opened. | |
bool | isClosed () |
Indicates if the dam is closed. | |
Static Public Attributes | |
static const bool | OPEN = true |
static const bool | CLOSED = false |
Defines a synchronization primitive that blocks any thread that call the wait method if the internal state for the primitive is "closed" and let them pass when the state becomes "open".
The internal Operating System signaling system is used only when necessary.
ANSI C++11 synchronization primitives don't have all the functionality needed to be used on shared memory. This is the reason the Dam has been created on top of POSIX primitives, because the intention is to use them to control inter-process communication with the assistance of the Operating System.
HSEP::Dam::Dam | ( | bool | pState = CLOSED , |
bool | pShared = false |
||
) |
void HSEP::Dam::close | ( | ) |
bool HSEP::Dam::isClosed | ( | ) |
bool HSEP::Dam::isOpen | ( | ) |
void HSEP::Dam::open | ( | ) |
Open the Dam, making any waiting "wait" to be completed.
Definition at line 88 of file Dam.cpp.
References isClosed(), and OPEN.
void HSEP::Dam::wait | ( | ) |
Wait until the Dam is opened.
If the Dam is opened when arriving to the wait, the wait finishes.
Definition at line 60 of file Dam.cpp.
References isClosed().
|
static |
Definition at line 59 of file Dam.h.
Referenced by close(), and isClosed().
|
static |