32 #ifndef _QORE_QORETHREADLOCK_H 34 #define _QORE_QORETHREADLOCK_H 54 pthread_mutex_t ptm_lock;
60 DLLLOCAL
void init(
const pthread_mutexattr_t* pma = 0) {
64 pthread_mutex_init(&ptm_lock, pma);
82 pthread_mutex_destroy(&ptm_lock);
97 pthread_mutex_lock(&ptm_lock);
108 pthread_mutex_unlock(&ptm_lock);
117 return pthread_mutex_trylock(&ptm_lock);
137 DLLLOCAL AutoLocker& operator=(
const AutoLocker&);
140 DLLLOCAL
void *
operator new(size_t);
158 DLLLOCAL ~AutoLocker() {
178 DLLLOCAL AutoUnlocker& operator=(
const AutoUnlocker&);
181 DLLLOCAL
void *
operator new(size_t);
200 DLLLOCAL ~AutoUnlocker() {
222 DLLLOCAL SafeLocker& operator=(
const SafeLocker&);
225 DLLLOCAL
void *
operator new(size_t);
248 DLLLOCAL ~SafeLocker() {
268 DLLLOCAL
void stay_locked() {
274 DLLLOCAL
void relock() {
292 DLLLOCAL OptLocker& operator=(
const OptLocker&);
295 DLLLOCAL
void *
operator new(size_t);
309 DLLLOCAL ~OptLocker() {
315 #endif // _QORE_QORETHREADLOCK_H DLLLOCAL ~QoreThreadLock()
destroys the lock
Definition: QoreThreadLock.h:81
DLLLOCAL int trylock()
attempts to acquire the mutex and returns the status immediately; does not block
Definition: QoreThreadLock.h:116
a thread condition class implementing a wrapper for pthread_cond_t
Definition: QoreCondition.h:45
provides a safe and exception-safe way to hold locks in Qore, only to be used on the stack...
Definition: QoreThreadLock.h:131
provides a safe and exception-safe way to hold optional locks in Qore, only to be used on the stack...
Definition: QoreThreadLock.h:286
DLLLOCAL void lock()
grabs the lock (assumes that the lock is unlocked)
Definition: QoreThreadLock.h:93
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:144
DLLLOCAL void unlock()
releases the lock (assumes that the lock is locked)
Definition: QoreThreadLock.h:104
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:185
bool locked
flag indicating if the lock is held or not
Definition: QoreThreadLock.h:232
provides a mutually-exclusive thread lock
Definition: QoreThreadLock.h:49
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:299
DLLLOCAL QoreThreadLock()
creates the lock
Definition: QoreThreadLock.h:71
QoreThreadLock * lck
the pointer to the lock that will be managed
Definition: QoreThreadLock.h:229
provides an exception-safe way to manage locks in Qore, only to be used on the stack, cannot be dynamically allocated
Definition: QoreThreadLock.h:216
provides a safe and exception-safe way to release and re-acquire locks in Qore, only to be used on th...
Definition: QoreThreadLock.h:172