fesa::Semaphore Class Reference

this class is a c++ wrapper for the sem_t class More...

#include <Semaphore.h>

List of all members.

Public Member Functions

 Semaphore (const std::string &semaphoreName, int32_t value)
 constructor
void wait ()
 wait in this thread until the value of the semaphore is greater than 0
int32_t tryWait ()
 perform a non-blocking wait
int32_t timedWait (const struct timespec *abs_timeout)
void post ()
 increases the value of the semaphore by 1
int32_t getValue ()
 this method returns the current value of the semaphore
 ~Semaphore ()
 destructor It implements a close and unlink of the semaphore. Allowing any resources that the system has allocated to the calling process for this semaphore to be freed.

Private Attributes

sem_t * semaphore_
 internal semaphore representation
std::string semaphoreName_
 name of the semaphore

Detailed Description

this class is a c++ wrapper for the sem_t class

Definition at line 16 of file Semaphore.h.


Constructor & Destructor Documentation

fesa::Semaphore::Semaphore ( const std::string &  semaphoreName,
int32_t  value 
)

constructor

Parameters:
semaphoreName string to identify the semaphore
value to initialize the semaphore
Exceptions:
FesaException 

Definition at line 17 of file Semaphore.cpp.

References FesaErrorOpeningSemaphore, semaphore_, semaphoreName_, and fesa::StringUtilities::toString().

fesa::Semaphore::~Semaphore (  ) 

destructor It implements a close and unlink of the semaphore. Allowing any resources that the system has allocated to the calling process for this semaphore to be freed.

Definition at line 31 of file Semaphore.cpp.

References semaphore_, and semaphoreName_.


Member Function Documentation

fesa::Semaphore::getValue (  ) 

this method returns the current value of the semaphore

Definition at line 89 of file Semaphore.cpp.

References FesaErrorGettingValueOfSemaphore, semaphore_, and fesa::StringUtilities::toString().

fesa::Semaphore::post (  ) 

increases the value of the semaphore by 1

Exceptions:
FesaException 

Definition at line 79 of file Semaphore.cpp.

References FesaErrorPostingSemaphore, semaphore_, and fesa::StringUtilities::toString().

Referenced by fesa::ShmFactory< GlobalDeviceType, DomainStoreType, DevInstType >::setUpMemory().

int32_t fesa::Semaphore::timedWait ( const struct timespec *  abs_timeout  ) 

Definition at line 65 of file Semaphore.cpp.

References FesaErrorTryWaitingForSemaphore, and semaphore_.

fesa::Semaphore::tryWait (  ) 

perform a non-blocking wait

Exceptions:
FesaException 

Definition at line 50 of file Semaphore.cpp.

References FesaErrorTryWaitingForSemaphore, semaphore_, and fesa::StringUtilities::toString().

fesa::Semaphore::wait (  ) 

wait in this thread until the value of the semaphore is greater than 0

Exceptions:
FesaException 

Definition at line 39 of file Semaphore.cpp.

References FesaErrorWaitingForSemaphore, semaphore_, and fesa::StringUtilities::toString().

Referenced by fesa::ShmFactory< GlobalDeviceType, DomainStoreType, DevInstType >::setUpMemory().


Member Data Documentation

internal semaphore representation

Definition at line 77 of file Semaphore.h.

Referenced by getValue(), post(), Semaphore(), timedWait(), tryWait(), wait(), and ~Semaphore().

name of the semaphore

Definition at line 83 of file Semaphore.h.

Referenced by Semaphore(), and ~Semaphore().


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

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1