#include <cel_syncobjs.h>
Public Member Functions | |
Semaphore (size_t inMax, const String &inName=NullString) | |
virtual void | lock () const |
virtual void | unlock () const |
This class implements the semaphore.
This class has its own DataTraits structure and it can be used with SimpleArray with some special restrictions; you can create, allocate, release the array of Semaphore instances but you could not reallocate (resize) the array.
Celartem::Semaphore::Semaphore | ( | size_t | inMax, |
const String & | inName = NullString |
||
) |
This constuctor creates a new anonymous/named semaphore or opens an existing named semaphore.
inMax | The size of the semaphore. |
inName | The name of the semaphore. For anonymous semaphore, this should be "". |
|
virtual |
Locks the semaphore. The recursive locks in the same thread are counted, this behavior is not compatible with Mutex. For exception-safe programming, you should use Locker class instead of calling lock and unlock directly.
Implements Celartem::Lockable.
|
virtual |
Unlocks the semaphore.
For exception-safe programming, you should use Locker class instead of calling lock and unlock directly.
Implements Celartem::Lockable.