summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-06-07 19:10:53 +0200
committerLiang Qi <liang.qi@qt.io>2018-06-07 19:10:53 +0200
commit096e37910d93f9c52976600e985c615ea36fe291 (patch)
tree713d020f4a04f03d8ca6e111055e7eebe85953a8 /src/corelib/thread/qthread.cpp
parent88eda007a3b5046999dd0b287634765efcd8934d (diff)
parenta14a943f9ac3d1e85514d7fb6688c84e624ac850 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: .qmake.conf src/corelib/kernel/qeventdispatcher_cf.mm src/gui/kernel/qguiapplication_p.h src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/qioseventdispatcher.mm src/plugins/platforms/windows/qwindowsdrag.h src/plugins/platforms/windows/qwindowsinternalmimedata.h src/plugins/platforms/windows/qwindowsmime.cpp src/plugins/platforms/winrt/qwinrtscreen.cpp Change-Id: Ic817f265c2386e83839d2bb9ef7419cb29705246
Diffstat (limited to 'src/corelib/thread/qthread.cpp')
-rw-r--r--src/corelib/thread/qthread.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 7d908fd4e7..23606411ff 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -219,14 +219,17 @@ QThreadPrivate::~QThreadPrivate()
It is important to remember that a QThread instance \l{QObject#Thread
Affinity}{lives in} the old thread that instantiated it, not in the
new thread that calls run(). This means that all of QThread's queued
- slots will execute in the old thread. Thus, a developer who wishes to
- invoke slots in the new thread must use the worker-object approach; new
- slots should not be implemented directly into a subclassed QThread.
-
- When subclassing QThread, keep in mind that the constructor executes in
- the old thread while run() executes in the new thread. If a member
- variable is accessed from both functions, then the variable is accessed
- from two different threads. Check that it is safe to do so.
+ slots and \l {QMetaObject::invokeMethod()}{invoked methods} will execute
+ in the old thread. Thus, a developer who wishes to invoke slots in the
+ new thread must use the worker-object approach; new slots should not be
+ implemented directly into a subclassed QThread.
+
+ Unlike queued slots or invoked methods, methods called directly on the
+ QThread object will execute in the thread that calls the method. When
+ subclassing QThread, keep in mind that the constructor executes in the
+ old thread while run() executes in the new thread. If a member variable
+ is accessed from both functions, then the variable is accessed from two
+ different threads. Check that it is safe to do so.
\note Care must be taken when interacting with objects across different
threads. See \l{Synchronizing Threads} for details.