All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HSEP::Dam Class Reference

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
 

Detailed Description

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.

Definition at line 47 of file Dam.h.

Constructor & Destructor Documentation

HSEP::Dam::Dam ( bool  pState = CLOSED,
bool  pShared = false 
)

Creates a synchronization Dam whose default state is closed.

Although the Dam has been designed to be used with shared memory areas, such functionality still need to be tested.

Parameters
pState
pShared

Definition at line 29 of file Dam.cpp.

HSEP::Dam::~Dam ( )
virtual

Definition at line 54 of file Dam.cpp.

Member Function Documentation

void HSEP::Dam::close ( )

Close the Dam.

Any forthcoming call to the wait method will wait until the open method be called.

Definition at line 104 of file Dam.cpp.

References CLOSED, and isOpen().

+ Here is the call graph for this function:

bool HSEP::Dam::isClosed ( )

Indicates if the dam is closed.

Doesn't change the dam internal state.

Returns
true when the dam is closed.

Definition at line 135 of file Dam.cpp.

References CLOSED.

Referenced by open(), and wait().

+ Here is the caller graph for this function:

bool HSEP::Dam::isOpen ( )

Indicates if the dam is opened.

Doesn't change the dam internal state.

Returns
true when the dam is opened.

Definition at line 126 of file Dam.cpp.

References OPEN.

Referenced by close().

+ Here is the caller graph for this function:

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.

+ Here is the call graph for this function:

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().

+ Here is the call graph for this function:

Member Data Documentation

const bool HSEP::Dam::CLOSED = false
static

Definition at line 59 of file Dam.h.

Referenced by close(), and isClosed().

const bool HSEP::Dam::OPEN = true
static

Definition at line 58 of file Dam.h.

Referenced by isOpen(), and open().


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