32#ifndef _QORE_QORETHREADLOCK_H
34#define _QORE_QORETHREADLOCK_H
62 pthread_mutex_init(&ptm_lock, ma);
72 pthread_mutex_destroy(&ptm_lock);
82 pthread_mutex_lock(&ptm_lock);
93 pthread_mutex_unlock(&ptm_lock);
102 return pthread_mutex_trylock(&ptm_lock);
107 pthread_mutex_t ptm_lock;
152 if (!already_locked) {
161 if (!already_locked) {
174 DLLLOCAL
void *
operator new(size_t) =
delete;
212 DLLLOCAL
void *
operator new(size_t) =
delete;
278 DLLLOCAL
void *
operator new(size_t) =
delete;
310 DLLLOCAL
void *
operator new(size_t) =
delete;
provides a safe and exception-safe way to hold locks in Qore, only to be used on the stack,...
Definition: QoreThreadLock.h:136
DLLLOCAL AutoLocker(QoreThreadLock *l)
creates the object and grabs the lock
Definition: QoreThreadLock.h:139
DLLLOCAL AutoLocker(QoreThreadLock *l, bool already_locked)
creates the object and grabs the lock
Definition: QoreThreadLock.h:151
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:178
DLLLOCAL AutoLocker(QoreThreadLock &l)
creates the object and grabs the lock
Definition: QoreThreadLock.h:144
DLLLOCAL AutoLocker(QoreThreadLock &l, bool already_locked)
creates the object and grabs the lock
Definition: QoreThreadLock.h:160
DLLLOCAL ~AutoLocker()
destroys the object and releases the lock
Definition: QoreThreadLock.h:167
provides a safe and exception-safe way to release and re-acquire locks in Qore, only to be used on th...
Definition: QoreThreadLock.h:190
DLLLOCAL ~AutoUnlocker()
grabs the lock and destroys the object
Definition: QoreThreadLock.h:204
DLLLOCAL AutoUnlocker(QoreThreadLock *l)
creates the object and releases the lock
Definition: QoreThreadLock.h:193
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:216
DLLLOCAL AutoUnlocker(QoreThreadLock &l)
creates the object and releases the lock
Definition: QoreThreadLock.h:199
provides a safe and exception-safe way to hold optional locks in Qore, only to be used on the stack,...
Definition: QoreThreadLock.h:293
DLLLOCAL OptLocker(QoreThreadLock *l)
creates the object and grabs the lock if the argument is not NULL
Definition: QoreThreadLock.h:296
DLLLOCAL ~OptLocker()
releases the lock if there is a lock pointer being managed and destroys the object
Definition: QoreThreadLock.h:302
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:314
a thread condition class implementing a wrapper for pthread_cond_t
Definition: QoreCondition.h:45
Implements a recursive lock.
Definition: QoreThreadLock.h:116
DLLLOCAL QoreRecursiveThreadLock(const QoreRecursiveThreadLock &)
Creates a new object (not based on the original lock status)
Definition: QoreThreadLock.h:122
DLLEXPORT QoreRecursiveThreadLock()
Creates the object.
provides a mutually-exclusive thread lock
Definition: QoreThreadLock.h:49
DLLLOCAL QoreThreadLock(const QoreThreadLock &)
creates a new object (not based on the original lock status)
Definition: QoreThreadLock.h:67
DLLLOCAL ~QoreThreadLock()
destroys the lock
Definition: QoreThreadLock.h:71
DLLLOCAL QoreThreadLock()
creates the lock
Definition: QoreThreadLock.h:54
DLLLOCAL QoreThreadLock(const pthread_mutexattr_t *ma)
creates the lock with the given attributes
Definition: QoreThreadLock.h:58
DLLLOCAL void lock()
grabs the lock (assumes that the lock is unlocked)
Definition: QoreThreadLock.h:78
DLLLOCAL int trylock()
attempts to acquire the mutex and returns the status immediately; does not block
Definition: QoreThreadLock.h:101
DLLLOCAL void unlock()
releases the lock (assumes that the lock is locked)
Definition: QoreThreadLock.h:89
provides an exception-safe way to manage locks in Qore, only to be used on the stack,...
Definition: QoreThreadLock.h:228
bool locked
flag indicating if the lock is held or not
Definition: QoreThreadLock.h:285
DLLLOCAL void relock()
relocks an unlock lock
Definition: QoreThreadLock.h:269
DLLLOCAL SafeLocker(QoreThreadLock *l)
creates the object and grabs the lock
Definition: QoreThreadLock.h:231
DLLLOCAL SafeLocker(QoreThreadLock &l)
creates the object and grabs the lock
Definition: QoreThreadLock.h:237
DLLLOCAL void lock()
locks the object and updates the locked flag, assumes that the lock is not already held
Definition: QoreThreadLock.h:249
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:282
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:263
DLLLOCAL ~SafeLocker()
destroys the object and unlocks the lock if it's held
Definition: QoreThreadLock.h:243
DLLLOCAL void unlock()
unlocks the object and updates the locked flag, assumes that the lock is held
Definition: QoreThreadLock.h:256