summaryrefslogtreecommitdiffstats
path: root/doc/src/frameworks-technologies/threads.qdoc
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-12-22 14:57:51 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-12-22 14:57:51 (GMT)
commit91bc1f39788a4a097e65f542b8515c68313ec17f (patch)
tree111f23861ce66ca30a17189fb611ff3854b57d66 /doc/src/frameworks-technologies/threads.qdoc
parentedd574758bdc4223a3d38b0f5cd0e1f11c537b55 (diff)
parent4c47a46be986681225b67faa73f957276636cc30 (diff)
downloadQt-91bc1f39788a4a097e65f542b8515c68313ec17f.zip
Qt-91bc1f39788a4a097e65f542b8515c68313ec17f.tar.gz
Qt-91bc1f39788a4a097e65f542b8515c68313ec17f.tar.bz2
Merge branch '4.7' of git://scm.dev.nokia.troll.no/qt/qt-water-team
* '4.7' of git://scm.dev.nokia.troll.no/qt/qt-water-team: (43 commits) Doc: Added a missing license header. Fix timer warning when deleting item views More testing for KeyNavigation attached properties. Add tests for ListView.indexAt() and GridView.IndexAt() runonphone: Only print the modprobe instructions on linux reword: Make the USB serial device enumeration work on OS X, too runonphone: Check that the device->config is valid before dereferencing it Remove few compile warnings Fix using QFileDialog statics in Symbian. Setting TextInput.cursorPosition outside bounds crashed. Update test bitmaps for QDeclarativeImage::svg() autotest on Windows Don't truncate image:// url strings prematurely Update docs on importing javascript files Fix deployment of minehunt for Symbian Quiet unused parameter warnings. doc: Replaced some \raw and \endraw uses with \table and \endtable doc: Replaced some \raw and \endraw uses with \table and \endtable doc: Replaced some \raw and \endraw uses with \table and \endtable Doc: Added a note about the Public Suffix List. Doc: Fixed doc bug in Diagram Scene example ...
Diffstat (limited to 'doc/src/frameworks-technologies/threads.qdoc')
-rw-r--r--doc/src/frameworks-technologies/threads.qdoc20
1 files changed, 15 insertions, 5 deletions
diff --git a/doc/src/frameworks-technologies/threads.qdoc b/doc/src/frameworks-technologies/threads.qdoc
index 001b29d..2a0cc1a 100644
--- a/doc/src/frameworks-technologies/threads.qdoc
+++ b/doc/src/frameworks-technologies/threads.qdoc
@@ -213,10 +213,10 @@
/*!
\page threads-reentrancy.html
\title Reentrancy and Thread-Safety
-
+
\keyword reentrant
\keyword thread-safe
-
+
\previouspage Synchronizing Threads
\contentspage Thread Support in Qt
\nextpage Threads and QObjects
@@ -243,6 +243,15 @@
from multiple threads, even if all the threads use the \e{same}
instance of the class.
+ \note Qt classes are only documented as \e{thread-safe} if they
+ are intended to be used by multiple threads. If a function is not
+ marked as thread-safe or reentrant, it should not be used from
+ different threads. If a class is not marked as thread-safe or
+ reentrant then a specific instance of that class should not be
+ accessed from different threads.
+
+ \section1 Reentrancy
+
C++ classes are often reentrant, simply because they only access
their own member data. Any thread can call a member function on an
instance of a reentrant class, as long as no other thread can call
@@ -268,6 +277,8 @@
end up overwriting each other, and the variable is incremented
only once!
+ \section1 Thread-Safety
+
Clearly, the access must be serialized: Thread A must perform
steps 1, 2, 3 without interruption (atomically) before thread B
can perform the same steps; or vice versa. An easy way to make
@@ -284,6 +295,8 @@
declared with the \c mutable qualifier because we need to lock
and unlock the mutex in \c value(), which is a const function.
+ \section1 Notes on Qt Classes
+
Many Qt classes are \e{reentrant}, but they are not made
\e{thread-safe}, because making them thread-safe would incur the
extra overhead of repeatedly locking and unlocking a QMutex. For
@@ -297,9 +310,6 @@
the thread-related classes (e.g. QMutex) and fundamental functions
(e.g. QCoreApplication::postEvent()).
- \note Qt Classes are only documented as \e{thread-safe} if they
- are intended to be used by multiple threads.
-
\note Terminology in the multithreading domain isn't entirely
standardized. POSIX uses definitions of reentrant and thread-safe
that are somewhat different for its C APIs. When using other