this class is a c++ wrapper for the sem_t class More...
#include <Semaphore.h>
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 |
this class is a c++ wrapper for the sem_t class
Definition at line 16 of file Semaphore.h.
fesa::Semaphore::Semaphore | ( | const std::string & | semaphoreName, | |
int32_t | value | |||
) |
constructor
semaphoreName | string to identify the semaphore | |
value | to initialize the semaphore |
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_.
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
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
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
FesaException |
Definition at line 39 of file Semaphore.cpp.
References FesaErrorWaitingForSemaphore, semaphore_, and fesa::StringUtilities::toString().
Referenced by fesa::ShmFactory< GlobalDeviceType, DomainStoreType, DevInstType >::setUpMemory().
fesa::Semaphore::semaphore_ [private] |
internal semaphore representation
Definition at line 77 of file Semaphore.h.
Referenced by getValue(), post(), Semaphore(), timedWait(), tryWait(), wait(), and ~Semaphore().
fesa::Semaphore::semaphoreName_ [private] |
name of the semaphore
Definition at line 83 of file Semaphore.h.
Referenced by Semaphore(), and ~Semaphore().