#include <unixstl/synch/semaphore.hpp>
Public Types | |
Member Constants | |
enum | { maxCountValue = _POSIX_SEM_VALUE_MAX } |
Member Types | |
typedef semaphore | class_type |
typedef sem_t * | handle_type |
typedef bool | bool_type |
typedef size_t | count_type |
typedef sem_t * | resource_type |
Public Member Functions | |
Construction | |
semaphore (handle_type sem, bool_type bTakeOwnership) | |
Conversion constructor. | |
semaphore (count_type initialCount, bool_type bInterProcessShared=false) | |
Creates an instance of the semaphore. | |
~semaphore () throw () | |
Destroys an instance of the semaphore. | |
Operations | |
void | lock () |
Acquires a lock on the semaphore, pending the thread until the lock is aquired. | |
bool_type | try_lock () |
Attempts to lock the semaphore. | |
void | unlock () |
Releases an aquired lock on the semaphore, increasing the semaphore's counter by one. | |
Accessors | |
handle_type | handle () throw () |
The underlying kernel object handle. | |
handle_type | get () throw () |
The underlying kernel object handle. |
semaphore | ( | handle_type | sem, | |
bool_type | bTakeOwnership | |||
) | [inline] |
semaphore | ( | count_type | initialCount, | |
bool_type | bInterProcessShared = false | |||
) | [inline, explicit] |
Creates an instance of the semaphore.
void lock | ( | ) | [inline] |
Acquires a lock on the semaphore, pending the thread until the lock is aquired.
References UNIXSTL_ASSERT.
bool_type try_lock | ( | ) | [inline] |
Attempts to lock the semaphore.
References UNIXSTL_ASSERT.
void unlock | ( | ) | [inline] |
Releases an aquired lock on the semaphore, increasing the semaphore's counter by one.
References UNIXSTL_ASSERT.
handle_type handle | ( | ) | throw () [inline] |
The underlying kernel object handle.
handle_type get | ( | ) | throw () [inline] |
The underlying kernel object handle.