34 #ifndef _QORE_QORERWLOCK_H 35 #define _QORE_QORERWLOCK_H 40 extern int gettid() noexcept;
61 pthread_rwlock_init(&m, 0);
70 pthread_rwlock_destroy(&m);
76 return pthread_rwlock_wrlock(&m);
81 return pthread_rwlock_trywrlock(&m);
86 return pthread_rwlock_unlock(&m);
91 return pthread_rwlock_rdlock(&m);
96 return pthread_rwlock_tryrdlock(&m);
111 DLLLOCAL QoreAutoRWReadLocker&
operator=(
const QoreAutoRWReadLocker&);
114 DLLLOCAL
void *
operator new(size_t);
133 DLLLOCAL ~QoreAutoRWReadLocker() {
150 DLLLOCAL QoreAutoRWWriteLocker&
operator=(
const QoreAutoRWWriteLocker&);
153 DLLLOCAL
void *
operator new(size_t);
172 DLLLOCAL ~QoreAutoRWWriteLocker() {
189 DLLLOCAL QoreSafeRWReadLocker&
operator=(
const QoreSafeRWReadLocker&);
192 DLLLOCAL
void *
operator new(size_t);
215 DLLLOCAL ~QoreSafeRWReadLocker() {
221 DLLLOCAL
void lock() {
235 DLLLOCAL
void stay_locked() {
252 DLLLOCAL QoreSafeRWWriteLocker&
operator=(
const QoreSafeRWWriteLocker&);
255 DLLLOCAL
void *
operator new(size_t);
278 DLLLOCAL ~QoreSafeRWWriteLocker() {
284 DLLLOCAL
void lock() {
298 DLLLOCAL
void stay_locked() {
304 class QoreOptionalRWWriteLocker {
315 DLLLOCAL ~QoreOptionalRWWriteLocker() {
320 DLLLOCAL
operator bool()
const {
325 class QoreOptionalRWReadLocker {
336 DLLLOCAL ~QoreOptionalRWReadLocker() {
341 DLLLOCAL
operator bool()
const {
346 class qore_var_rwlock_priv;
348 class QoreVarRWLock {
351 DLLLOCAL QoreVarRWLock(
const QoreVarRWLock&);
353 DLLLOCAL QoreVarRWLock&
operator=(
const QoreVarRWLock&);
356 qore_var_rwlock_priv* priv;
358 DLLLOCAL QoreVarRWLock(qore_var_rwlock_priv* p);
361 DLLLOCAL QoreVarRWLock();
364 DLLLOCAL ~QoreVarRWLock();
provides a safe and exception-safe way to hold write locks in Qore, only to be used on the stack...
Definition: QoreRWLock.h:144
DLLLOCAL int wrlock()
grabs the write lock
Definition: QoreRWLock.h:75
DLLEXPORT int gettid() noexcept
returns the current TID number
DLLLOCAL QoreRWLock()
creates and initializes the lock
Definition: QoreRWLock.h:57
DLLLOCAL ~QoreRWLock()
destroys the lock
Definition: QoreRWLock.h:66
bool locked
lock flag
Definition: QoreRWLock.h:262
bool locked
lock flag
Definition: QoreRWLock.h:199
provides a safe and exception-safe way to hold write locks in Qore, only to be used on the stack...
Definition: QoreRWLock.h:246
DLLLOCAL int unlock()
unlocks the lock (assumes the lock is locked)
Definition: QoreRWLock.h:85
DLLLOCAL int rdlock()
grabs the read lock
Definition: QoreRWLock.h:90
provides a safe and exception-safe way to hold read locks in Qore, only to be used on the stack...
Definition: QoreRWLock.h:105
provides a safe and exception-safe way to hold read locks in Qore, only to be used on the stack...
Definition: QoreRWLock.h:183
QoreRWLock * l
the pointer to the lock that will be managed
Definition: QoreRWLock.h:157
QoreRWLock * l
the pointer to the lock that will be managed
Definition: QoreRWLock.h:118
provides a simple POSIX-threads-based read-write lock
Definition: QoreRWLock.h:47
pthread_rwlock_t m
the actual locking primitive wrapped in this class
Definition: QoreRWLock.h:50
DLLLOCAL int tryrdlock()
tries to grab the read lock; does not block if unsuccessful; returns 0 if successful ...
Definition: QoreRWLock.h:95
DLLLOCAL QoreRWLock & operator=(const QoreRWLock &)
this function is not implemented; it is here as a private function in order to prohibit it from being...
QoreRWLock * l
the pointer to the lock that will be managed
Definition: QoreRWLock.h:259
QoreRWLock * l
the pointer to the lock that will be managed
Definition: QoreRWLock.h:196
DLLLOCAL int trywrlock()
tries to grab the write lock; does not block if unsuccessful; returns 0 if successful ...
Definition: QoreRWLock.h:80