Qore Programming Language Reference Manual  0.9.4
QC_RWLock.dox.h
1 namespace Qore {
4 namespace Thread {
6 
40 class RWLock : public AbstractSmartLock {
41 
42 public:
44 
49  constructor();
50 
51 public:
53 
58  copy();
59 
60 public:
62 
71  destructor();
72 
73 public:
75 
85 int getReadWaiting();
86 
87 public:
89 
99 int getWriteWaiting();
100 
101 public:
103 
114 bool lockOwner();
115 
116 public:
118 
128 int numReaders();
129 
130 public:
132 
140 nothing readLock();
141 
142 public:
144 
159 int readLock(timeout timeout_ms);
160 
161 public:
163 
174 bool readLockOwner();
175 
176 public:
178 
185 nothing readUnlock();
186 
187 public:
189 
199 int tryReadLock();
200 
201 public:
203 
212 int tryWriteLock();
213 
214 public:
216 
231 int writeLock(timeout timeout_ms);
232 
233 public:
235 
243 nothing writeLock();
244 
245 public:
247 
258 bool writeLockOwner();
259 
260 public:
262 
269 nothing writeUnlock();
270 };
271 }
272 }
The abstract base class for locks that support the internal API for use with the Condition class.
Definition: QC_AbstractSmartLock.dox.h:15
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....
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,...
The RWLock class implements a read-write thread lock.
Definition: QC_RWLock.dox.h:40
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3
int tryReadLock()
Acquires the read lock only if it can be acquired immediately.
int numReaders()
Returns the read lock count.