Qore Programming Language Reference Manual  0.8.9
 All Classes Namespaces Functions Variables Groups Pages
QC_RWLock.dox.h
1 namespace Qore::Thread {
4 
31 class RWLock : public AbstractSmartLock {
32 
33 public:
35 
40  constructor();
41 
42 public:
44 
49  copy();
50 
51 public:
53 
62  destructor();
63 
64 public:
66 
76 int getReadWaiting();
77 
78 public:
80 
90 int getWriteWaiting();
91 
92 public:
94 
105 bool lockOwner();
106 
107 public:
109 
119 int numReaders();
120 
121 public:
123 
131 nothing readLock();
132 
133 public:
135 
150 int readLock(timeout timeout_ms);
151 
152 public:
154 
165 bool readLockOwner();
166 
167 public:
169 
176 nothing readUnlock();
177 
178 public:
180 
190 int tryReadLock();
191 
192 public:
194 
203 int tryWriteLock();
204 
205 public:
207 
222 int writeLock(timeout timeout_ms);
223 
224 public:
226 
234 nothing writeLock();
235 
236 public:
238 
249 bool writeLockOwner();
250 
251 public:
253 
260 nothing writeUnlock();
261 };
262 };
The abstract base class for locks that support the internal API for use with the Condition class...
Definition: QC_AbstractSmartLock.dox.h:13
nothing writeLock()
Acquires the write lock; blocks if the read lock is already acquired by another thread.
int getReadWaiting()
Returns the number of threads waiting on the read lock.
bool writeLockOwner()
Returns True if the current thread is holding the write lock, False if not.
bool readLockOwner()
Returns True if the current thread is holding the read lock, False if not.
int tryWriteLock()
Acquires the write lock only if it can be acquired immediately.
destructor()
Destroys the RWLock object.
constructor()
Creates the RWLock object.
nothing readUnlock()
Decrements the read lock counter and releases the read lock if the counter is zero. If at least one thread is blocked trying to acquire the write lock and the read counter reaches zero, then one thread waiting on the write lock is woken up.
nothing readLock()
Acquires the read lock; blocks if the write lock is already acquired by another thread.
nothing writeUnlock()
Releases the write lock, if any readers are waiting, wakes up all readers, otherwise if any writers a...
copy()
Creates a new RWLock object, not based on the original.
int getWriteWaiting()
Returns the number of threads waiting on the write lock.
bool lockOwner()
Returns True if the current thread is holding either the read lock or the write lock, False if not.
The RWLock class implements a read-write thread lock.
Definition: QC_RWLock.dox.h:31
int tryReadLock()
Acquires the read lock only if it can be acquired immediately.
int numReaders()
Returns the read lock count.