Qore Programming Language Reference Manual  0.8.12.2
 All Classes Namespaces Functions Variables Groups Pages
QC_RWLock.dox.h
1 namespace Qore::Thread {
4 
38 class RWLock : public AbstractSmartLock {
39 
40 public:
42 
47  constructor();
48 
49 public:
51 
56  copy();
57 
58 public:
60 
69  destructor();
70 
71 public:
73 
83 int getReadWaiting();
84 
85 public:
87 
97 int getWriteWaiting();
98 
99 public:
101 
112 bool lockOwner();
113 
114 public:
116 
126 int numReaders();
127 
128 public:
130 
138 nothing readLock();
139 
140 public:
142 
157 int readLock(timeout timeout_ms);
158 
159 public:
161 
172 bool readLockOwner();
173 
174 public:
176 
183 nothing readUnlock();
184 
185 public:
187 
197 int tryReadLock();
198 
199 public:
201 
210 int tryWriteLock();
211 
212 public:
214 
229 int writeLock(timeout timeout_ms);
230 
231 public:
233 
241 nothing writeLock();
242 
243 public:
245 
256 bool writeLockOwner();
257 
258 public:
260 
267 nothing writeUnlock();
268 };
269 };
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:38
int tryReadLock()
Acquires the read lock only if it can be acquired immediately.
int numReaders()
Returns the read lock count.