VideoTools
|
A semaphore class with a posix or sysv implementation chosen at build-time. More...
#include <gsemaphore.h>
Classes | |
struct | storage_type |
semaphore storage More... | |
Public Member Functions | |
Semaphore (unsigned int initial_value=1U) | |
Constructor for a new anonymous semaphore, typically located inside a shared memory segment using "placement new". More... | |
~Semaphore () | |
Destroys the semaphore. More... | |
void | increment () |
Increment operator. Used for mutex unlocking. | |
void | decrement () |
Decrement-but-block-if-zero operator. More... | |
bool | decrement (int timeout_s) |
Overload with a timeout. Returns true if decremented. | |
Static Public Member Functions | |
static Semaphore * | at (storage_type *) |
Syntactic sugar to return an object pointer corresponding to the given storage pointer. More... | |
Friends | |
class | G::SemaphoreImp |
A semaphore class with a posix or sysv implementation chosen at build-time.
Eg.
Definition at line 47 of file gsemaphore.h.
|
explicit |
Constructor for a new anonymous semaphore, typically located inside a shared memory segment using "placement new".
The initial value should be one for a mutex.
Definition at line 43 of file gsemaphore_posix.cpp.
G::Semaphore::~Semaphore | ( | ) |
Destroys the semaphore.
Results are undefined if there are waiters.
Definition at line 54 of file gsemaphore_posix.cpp.
|
static |
Syntactic sugar to return an object pointer corresponding to the given storage pointer.
Definition at line 37 of file gsemaphore_posix.cpp.
void G::Semaphore::decrement | ( | ) |
Decrement-but-block-if-zero operator.
Used for mutex locking.
Definition at line 74 of file gsemaphore_posix.cpp.