#include <tsemaphore.h>
Collaboration diagram for Semaphore:
Public Member Functions | |
Semaphore (int initial_value=0) | |
Set up a semaphore with passed initial value defaulting to 0:. | |
~Semaphore () | |
int | value () |
Get the current value of the semaphore:. | |
void | post () |
Increase the semaphore counter:. | |
void | wait () |
bool | test () |
Private Attributes | |
ConditionMutex | m |
WaitCondition | c |
volatile int | v |
volatile needed? |
Definition at line 51 of file tsemaphore.h.
|
Set up a semaphore with passed initial value defaulting to 0:.
Definition at line 64 of file tsemaphore.h. References USE_PRIVATE__POSIX_SEMAPHORES. |
|
Destroy a semaphore. Make sure no thread is waiting for it before destroying a semaphore. Definition at line 73 of file tsemaphore.h. References USE_PRIVATE__POSIX_SEMAPHORES. |
|
Increase the semaphore counter:.
Definition at line 21 of file tsemaphore.cc. References WaitCondition::broadcast(), c, ConditionMutex::lock(), m, ConditionMutex::unlock(), and v. |
|
Non-blocking version. If the value of the semaphore is >0, decrease it and return 0. Otherwise return 1 instead of waiting. Definition at line 52 of file tsemaphore.cc. References ConditionMutex::lock(), m, ConditionMutex::unlock(), and v. |
|
Get the current value of the semaphore:.
Definition at line 81 of file tsemaphore.h. References USE_PRIVATE__POSIX_SEMAPHORES. |
|
Wait for semaphore to become non-zero, then atomically decrease the semaphore count. Definition at line 32 of file tsemaphore.cc. References c, ConditionMutex::lock(), m, ConditionMutex::unlock(), v, and WaitCondition::wait(). |
|
Definition at line 58 of file tsemaphore.h. |
|
Definition at line 57 of file tsemaphore.h. |
|
volatile needed?
Definition at line 59 of file tsemaphore.h. |