Image Component Library (ICL)
|
Simple Semaphore implementation wrapping the standard linux "sem_t"-struct. More...
#include <Semaphore.h>
Public Member Functions | |
Semaphore (int n=1) | |
create a semaphore initialized with n resources More... | |
void | operator++ (int dummy) |
releases a resource More... | |
void | operator-- (int dummy) |
acquires a new resource More... | |
void | operator+= (int val) |
releases val resources More... | |
void | operator-= (int val) |
acquires val resources More... | |
void | acquire (int val=1) |
releases val resources More... | |
void | release (int val=1) |
acquires val resources More... | |
bool | tryAcquire () |
trys to acquire one resource if successfull it returns true else false More... | |
bool | tryRelease () |
releases one resource only if resources are aqcuired More... | |
int | getValue () |
returns the current value More... | |
int | getMaxValue () |
returns the semaphores max-value More... | |
Public Member Functions inherited from icl::utils::ShallowCopyable< SemaphoreImpl, SemaphoreImplDelOp > | |
bool | isNull () const |
returns wheter the objects implementation holds a null pointer More... | |
Additional Inherited Members | |
Public Types inherited from icl::utils::ShallowCopyable< SemaphoreImpl, SemaphoreImplDelOp > | |
typedef ShallowCopyable< SemaphoreImpl, SemaphoreImplDelOp > | ParentSC |
Protected Member Functions inherited from icl::utils::ShallowCopyable< SemaphoreImpl, SemaphoreImplDelOp > | |
ShallowCopyable (SemaphoreImpl *t=0) | |
create a the implementation with a given T* value More... | |
Protected Attributes inherited from icl::utils::ShallowCopyable< SemaphoreImpl, SemaphoreImplDelOp > | |
SmartPtrBase< SemaphoreImpl, SemaphoreImplDelOp > | impl |
shared pointer for the classes implementation More... | |
Simple Semaphore implementation wrapping the standard linux "sem_t"-struct.
icl::utils::Semaphore::Semaphore | ( | int | n = 1 | ) |
create a semaphore initialized with n resources
|
inline |
releases val resources
int icl::utils::Semaphore::getMaxValue | ( | ) |
returns the semaphores max-value
int icl::utils::Semaphore::getValue | ( | ) |
returns the current value
void icl::utils::Semaphore::operator++ | ( | int | dummy | ) |
releases a resource
void icl::utils::Semaphore::operator+= | ( | int | val | ) |
releases val resources
void icl::utils::Semaphore::operator-- | ( | int | dummy | ) |
acquires a new resource
void icl::utils::Semaphore::operator-= | ( | int | val | ) |
acquires val resources
|
inline |
acquires val resources
bool icl::utils::Semaphore::tryAcquire | ( | ) |
trys to acquire one resource if successfull it returns true else false
bool icl::utils::Semaphore::tryRelease | ( | ) |
releases one resource only if resources are aqcuired