32 #ifndef _QORE_QORETHREADLOCK_H 34 #define _QORE_QORETHREADLOCK_H 52 pthread_mutex_t ptm_lock;
58 DLLLOCAL
void init(
const pthread_mutexattr_t* pma = 0) {
62 pthread_mutex_init(&ptm_lock, pma);
79 pthread_mutex_destroy(&ptm_lock);
94 pthread_mutex_lock(&ptm_lock);
105 pthread_mutex_unlock(&ptm_lock);
114 return pthread_mutex_trylock(&ptm_lock);
137 DLLLOCAL
void *
operator new(size_t);
158 if (!already_locked) {
167 if (!already_locked) {
196 DLLLOCAL
void *
operator new(size_t);
239 DLLLOCAL
void *
operator new(size_t);
309 DLLLOCAL
void *
operator new(size_t);
329 #endif // _QORE_QORETHREADLOCK_H DLLLOCAL ~QoreThreadLock()
destroys the lock
Definition: QoreThreadLock.h:78
DLLLOCAL ~AutoUnlocker()
grabs the lock and destroys the object
Definition: QoreThreadLock.h:215
DLLLOCAL ~AutoLocker()
destroys the object and releases the lock
Definition: QoreThreadLock.h:173
DLLLOCAL void stay_locked()
will not unlock the lock when the destructor is run; do not use any other functions of this class aft...
Definition: QoreThreadLock.h:282
DLLLOCAL int trylock()
attempts to acquire the mutex and returns the status immediately; does not block
Definition: QoreThreadLock.h:113
a thread condition class implementing a wrapper for pthread_cond_t
Definition: QoreCondition.h:45
DLLLOCAL void unlock()
unlocks the object and updates the locked flag, assumes that the lock is held
Definition: QoreThreadLock.h:275
DLLLOCAL void relock()
relocks an unlock lock
Definition: QoreThreadLock.h:288
provides a safe and exception-safe way to hold locks in Qore, only to be used on the stack...
Definition: QoreThreadLock.h:128
provides a safe and exception-safe way to hold optional locks in Qore, only to be used on the stack...
Definition: QoreThreadLock.h:300
DLLLOCAL void lock()
grabs the lock (assumes that the lock is unlocked)
Definition: QoreThreadLock.h:90
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:141
DLLLOCAL void unlock()
releases the lock (assumes that the lock is locked)
Definition: QoreThreadLock.h:101
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:200
DLLLOCAL ~SafeLocker()
destroys the object and unlocks the lock if it's held
Definition: QoreThreadLock.h:262
bool locked
flag indicating if the lock is held or not
Definition: QoreThreadLock.h:246
provides a mutually-exclusive thread lock
Definition: QoreThreadLock.h:47
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:313
DLLLOCAL QoreThreadLock()
creates the lock
Definition: QoreThreadLock.h:68
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:243
DLLLOCAL void lock()
locks the object and updates the locked flag, assumes that the lock is not already held ...
Definition: QoreThreadLock.h:268
provides an exception-safe way to manage locks in Qore, only to be used on the stack, cannot be dynamically allocated
Definition: QoreThreadLock.h:230
provides a safe and exception-safe way to release and re-acquire locks in Qore, only to be used on th...
Definition: QoreThreadLock.h:187
DLLLOCAL ~OptLocker()
releases the lock if there is a lock pointer being managed and destroys the object ...
Definition: QoreThreadLock.h:323