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 () |
virtual Mutex * | lockableMutex () |
virtual Semaphore * | lockableSemaphore () |
virtual RWLock * | lockableRWLock () |
Static Public Member Functions | |
static void | wait (unsigned long maxwait) |
static unsigned long | wait () |
static void | startUsingNow () |
static void | enableSafety (bool safe=true) |
static bool | safety () |
Abstract interface for lockable objects.
An abstract base class for implementing lockable objects
|
virtual |
Destructor
|
virtual |
Check if the object is unlocked (try to lock and unlock it)
maxwait | Time in microseconds to wait, -1 to wait forever |
|
static |
Enable some safety and sanity check features. This provides a safer code and easier locking debugging at the price of performance penalty. This method must be called early and not changed after initialization
safe | True to enable locking safety measures, false to disable |
|
pure virtual |
Attempt to lock the object and eventually wait for it
maxwait | Time in microseconds to wait, -1 wait forever |
Implemented in Mutex, RWLock, and Semaphore.
Referenced by Lock::acquire().
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
pure virtual |
|
static |
Retrieve safety and sanity check features flag value
|
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.
|
pure virtual |
|
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 |
Get the maximum wait time used for debugging purposes
|
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 |