priority over any readers that might also be waiting.
Like QMutex, a QReadWriteLock can be recursively locked by the
- same thread when constructed in
+ same thread when constructed with \l{QReadWriteLock::Recursive} as
\l{QReadWriteLock::RecursionMode}. In such cases,
unlock() must be called the same number of times lockForWrite() or
lockForRead() was called. Note that the lock type cannot be
/*!
Locks the lock for reading. This function will block the current
- thread if any thread (including the current) has locked for
- writing.
+ thread if another thread has locked for writing.
+
+ It is not possible to lock for read if the thread already has
+ locked for write.
\sa unlock(), lockForWrite(), tryLockForRead()
*/
writing.
If the lock was obtained, the lock must be unlocked with unlock()
- before another thread can successfully lock it.
+ before another thread can successfully lock it for writing.
+
+ It is not possible to lock for read if the thread already has
+ locked for write.
\sa unlock(), lockForRead()
*/
lock can be locked for reading when \a timeout is negative.
If the lock was obtained, the lock must be unlocked with unlock()
- before another thread can successfully lock it.
+ before another thread can successfully lock it for writing.
+
+ It is not possible to lock for read if the thread already has
+ locked for write.
\sa unlock(), lockForRead()
*/
/*!
Locks the lock for writing. This function will block the current
- thread if another thread has locked for reading or writing.
+ thread if another thread (including the current) has locked for
+ reading or writing (unless the lock has been created using the
+ \l{QReadWriteLock::Recursive} mode).
+
+ It is not possible to lock for write if the thread already has
+ locked for read.
\sa unlock(), lockForRead(), tryLockForWrite()
*/
If the lock was obtained, the lock must be unlocked with unlock()
before another thread can successfully lock it.
+ It is not possible to lock for write if the thread already has
+ locked for read.
+
\sa unlock(), lockForWrite()
*/
bool QReadWriteLock::tryLockForWrite()
If the lock was obtained, the lock must be unlocked with unlock()
before another thread can successfully lock it.
+ It is not possible to lock for write if the thread already has
+ locked for read.
+
\sa unlock(), lockForWrite()
*/
bool QReadWriteLock::tryLockForWrite(int timeout)