#include <psemaphore.h>
Public Member Functions | |
| Semaphore (const char *name=0, unsigned int initial=0) throw (SyncError) | |
| Default constructor. | |
| ~Semaphore () throw (SyncError) | |
| Destructor. | |
| void | wait () throw (SyncError) |
| Wait for the semaphore to become signaled. | |
| bool | tryWait () throw (SyncError) |
| Non-blocking wait for semaphore. | |
| void | post () throw (SyncError) |
| Increases the semaphore count. | |
Semaphores are counters for resources shared between threads or processes. The basic operations on semaphores are: increment the counter atomically, and wait until the counter is non-null and decrement it atomically.
Definition at line 36 of file psemaphore.h.
|
||||||||||||
|
Default constructor. Construct's a semaphore object. The semaphore may be process- shared if a name is supplied. On systems with SYSV semaphores the name must reffer to an existing file and the process must be able to stat() the file. On systems that do not have SYSV semaphores a semaphore cannot be process shared otherwise a SyncError will be thrown.
|
|
|
Destructor.
|
|
|
Increases the semaphore count.
|
|
|
Non-blocking wait for semaphore. If the semahore is signaled (count greater than zero), atomically decreases the semaphore count and returns true. If the semaphore is currently not signaled (count is equal to zero) it immediatly returns false.
|
|
|
Wait for the semaphore to become signaled. Waits for the semaphore to become signaled (count is greater than zero) and atomically decreases the semaphore count.
|
1.3.3