| Yate
    | 
Semaphore implementation. More...
#include <yateclass.h>
 
  
| Public Member Functions | |
| Semaphore (unsigned int maxcount=1, const char *name=0, unsigned int initialCount=1) | |
| Semaphore (const Semaphore &original) | |
| ~Semaphore () | |
| Semaphore & | operator= (const Semaphore &original) | 
| virtual bool | lock (long maxwait=-1) | 
| virtual bool | unlock () | 
| virtual bool | locked () const | 
| virtual Semaphore * | lockableSemaphore () | 
|  Public Member Functions inherited from Lockable | |
| virtual | ~Lockable () | 
| virtual bool | check (long maxwait=-1) | 
| virtual bool | unlockAll () | 
| virtual Mutex * | lockableMutex () | 
| virtual RWLock * | lockableRWLock () | 
| Static Public Member Functions | |
| static int | count () | 
| static int | locks () | 
| static bool | efficientTimedLock () | 
|  Static Public Member Functions inherited from Lockable | |
| static void | wait (unsigned long maxwait) | 
| static unsigned long | wait () | 
| static void | startUsingNow () | 
| static void | enableSafety (bool safe=true) | 
| static bool | safety () | 
| Friends | |
| class | SemaphorePrivate | 
Semaphore implementation.
A semaphore object for synchronizing threads, can also be used as a token bucket
| 
 | explicit | 
Construct a new unlocked semaphore
| maxcount | Maximum unlock count, must be strictly positive | 
| name | Static name of the semaphore (for debugging purpose only) | 
| initialCount | Initial semaphore count, must not be greater than maxcount | 
Copy constructor, creates a shared semaphore
| original | Reference of the semaphore to share | 
| ~Semaphore | ( | ) | 
Destroy the semaphore
| 
 | static | 
Get the number of semaphores counting the shared ones only once
| 
 | static | 
Check if a timed lock() is efficient on this platform
| 
 | virtual | 
| 
 | inlinevirtual | 
| 
 | virtual | 
Check if the semaphore is currently locked (waiting) - as it's asynchronous it guarantees nothing if other thread changes status
Implements Lockable.
| 
 | static | 
Get the number of currently locked (waiting) semaphores
Assignment operator makes the semaphore shared with the original
| original | Reference of the semaphore to share | 
| 
 | virtual | 
Unlock the semaphore, does never wait nor get over counter maximum
Implements Lockable.