Review of documentation.
authorMichele Caini <michele.caini@gmail.com>
Tue, 23 Oct 2012 20:39:35 +0000 (22:39 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 2 Nov 2012 18:49:22 +0000 (19:49 +0100)
Documentation has been updated, changes apply to Qt5 as well as Qt4.

Change-Id: I13241a3b4c16d2cb1b24f80fe26832467621923a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
src/corelib/thread/qreadwritelock.cpp

index 32dbdbb..ed88db9 100644 (file)
@@ -82,7 +82,7 @@ QT_BEGIN_NAMESPACE
     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
@@ -133,8 +133,10 @@ QReadWriteLock::~QReadWriteLock()
 
 /*!
     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()
 */
@@ -177,7 +179,10 @@ void QReadWriteLock::lockForRead()
     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()
 */
@@ -222,7 +227,10 @@ bool QReadWriteLock::tryLockForRead()
     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()
 */
@@ -262,7 +270,12 @@ bool QReadWriteLock::tryLockForRead(int timeout)
 
 /*!
     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()
 */
@@ -304,6 +317,9 @@ void QReadWriteLock::lockForWrite()
     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()
@@ -348,6 +364,9 @@ 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)