summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSze Howe Koh <szehowe.koh@gmail.com>2014-02-25 09:23:48 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-13 17:17:35 +0100
commitdd03e7db8f47fb79bd9120fb03e118fa86668cd3 (patch)
tree78ab507fcdbc7bb6a0443298c2a95e64ee27a258 /doc
parent28984cd5ba63c557b88377f996a90b9665f37745 (diff)
downloadqt4-tools-dd03e7db8f47fb79bd9120fb03e118fa86668cd3.tar.gz
Doc: Update, and reduce duplication of, QThread-related info
Added/Changed: - Move content from the Thread Basics overview to the QThread class ref - Rephrase bits for clarity - Use more links Removed: - (threads-basics.qdoc) Warning against moveToThread(this): This usage came about when people tried to add slots to a QThread subclass. This patch adds a warning against the root cause. - (threads-basics.qdoc) The strategy for managing member variables: Sounds error-prone. Pushing results through signals is safer. - (qthread.cpp) The note about GUI classes: Irrelevant to QThread, and it's already mentioned elsewhere. This is a cherry-pick from a9d5627e6a7b82 in qtbase.git. Change-Id: I491f64f998050daf0251abb2126bc9f7a198c17d Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/src/tutorials/threads.qdoc25
1 files changed, 0 insertions, 25 deletions
diff --git a/doc/src/tutorials/threads.qdoc b/doc/src/tutorials/threads.qdoc
index ad66b9f061..18e0cdc4c9 100644
--- a/doc/src/tutorials/threads.qdoc
+++ b/doc/src/tutorials/threads.qdoc
@@ -291,31 +291,6 @@
still important.
On Linux, Valgrind and Helgrind can help detect threading errors.
- The anatomy of QThread is quite interesting:
-
- \list
- \o QThread does not live in the new thread where \l{QThread::}{run()} is
- executed. It lives in the old thread.
- \o Most QThread methods are the thread's control interface and are meant to
- be called from the old thread. Do not move this interface to the newly
- created thread using \l{QObject::}{moveToThread()}; i.e., calling
- \l{QObject::moveToThread()}{moveToThread(this)} is regarded as bad
- practice.
- \o \l{QThread::}{exec()} and the static methods
- \l{QThread::}{usleep()}, \l{QThread::}{msleep()},
- \l{QThread::}{sleep()} are meant to be called from the newly created
- thread.
- \o Additional members defined in the QThread subclass are
- accessible by both threads. The developer is responsible for
- coordinating access. A typical strategy is to set the members before
- \l{QThread::}{start()} is called. Once the worker thread is running,
- the main thread should not touch the additional members anymore. After
- the worker has terminated, the main thread can access the additional
- members again. This is a convenient strategy for passing parameters to a
- thread before it is started as well as for collecting the result once it
- has terminated.
- \endlist
-
\section2 Using a Mutex to Protect the Integrity of Data
A mutex is an object that has \l{QMutex::}{lock()} and \l{QMutex::}{unlock()}