Yate
|
Abstract interface for lockable objects. More...
#include <yateclass.h>
Public Member Functions | |
virtual | ~Lockable () |
virtual bool | lock (long maxwait=-1)=0 |
virtual bool | unlock ()=0 |
virtual bool | locked () const =0 |
virtual bool | check (long maxwait=-1) |
virtual bool | unlockAll () |
Static Public Member Functions | |
static void | wait (unsigned long maxwait) |
static unsigned long | wait () |
static void | startUsingNow () |
static void | disableSafety () |
Abstract interface for lockable objects.
An abstract base class for implementing lockable objects
virtual ~Lockable | ( | ) | [virtual] |
Destructor
virtual bool check | ( | long | maxwait = -1 | ) | [virtual] |
Check if the object is unlocked (try to lock and unlock it)
maxwait | Time in microseconds to wait, -1 to wait forever |
static void disableSafety | ( | ) | [static] |
Disable some safety and sanity check features. This provides a performance improvement but makes the code less safe and more difficult to debug locking issues.
virtual bool lock | ( | long | maxwait = -1 | ) | [pure virtual] |
Attempt to lock the object and eventually wait for it
maxwait | Time in microseconds to wait, -1 wait forever |
Implemented in Semaphore, and Mutex.
Referenced by Lock::Lock().
virtual bool locked | ( | ) | const [pure virtual] |
static void startUsingNow | ( | ) | [static] |
Start actually using lockables, for platforms where these objects are not usable in global object constructors. This method must be called at least once somewhere from main() but before creating any threads and without holding any object locked.
virtual bool unlock | ( | ) | [pure virtual] |
Unlock the object, does never wait
Implemented in Semaphore, and Mutex.
Referenced by Lock::drop().
virtual bool unlockAll | ( | ) | [virtual] |
Fully unlock the object, even if it was previously multiple locked. There is no guarantee about the object status after the function returns. This function should be used only if you understand it very well
static void wait | ( | unsigned long | maxwait | ) | [static] |
Set a maximum wait time for debugging purposes
maxwait | Maximum time in microseconds to wait for any lockable object when no time limit was requested, zero to disable limit |
static unsigned long wait | ( | ) | [static] |
Get the maximum wait time used for debugging purposes