summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiłosz Kosobucki <milosz@kosobucki.pl>2017-11-11 21:05:39 +0100
committerMiłosz Kosobucki <milosz@kosobucki.pl>2019-04-28 11:17:30 +0000
commit13f5e5c6b2c320c33dd0b9305de410bef1b3c2c2 (patch)
treeffa963c3650c7cee2e3244aa275c862880b32b0f /src
parentc9002ab7eec1649d700865eac418f1f5d3b0d1a2 (diff)
Improve QObject::moveToThread doc
Change mentions of parameter value being "zero" to nullptr. Clarify that when nullptr is passed to moveToThread() event processing is stopped because the object is no longer associated with any thread. Also, reitarete this fact in the paragraph about processing of new events. There's an exception to the rule that QObjects cannot be "pulled" by moveToThread that is buried in the implementation and not mentioned in the doc. This information is worth noting explicitly. Change-Id: I816ff737c48d8057b39e36b566079710aeb8e690 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qobject.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index a791d2e8b3..2a05f7f383 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1445,8 +1445,9 @@ QThread *QObject::thread() const
\snippet code/src_corelib_kernel_qobject.cpp 7
- If \a targetThread is zero, all event processing for this object
- and its children stops.
+ If \a targetThread is \nullptr, all event processing for this object
+ and its children stops, as they are no longer associated with any
+ thread.
Note that all active timers for the object will be reset. The
timers are first stopped in the current thread and restarted (with
@@ -1457,13 +1458,18 @@ QThread *QObject::thread() const
A QEvent::ThreadChange event is sent to this object just before
the thread affinity is changed. You can handle this event to
perform any special processing. Note that any new events that are
- posted to this object will be handled in the \a targetThread.
+ posted to this object will be handled in the \a targetThread,
+ provided it is non-null: when it is \nullptr, no event processing
+ for this object or its children can happen, as they are no longer
+ associated with any thread.
\warning This function is \e not thread-safe; the current thread
must be same as the current thread affinity. In other words, this
function can only "push" an object from the current thread to
another thread, it cannot "pull" an object from any arbitrary
- thread to the current thread.
+ thread to the current thread. There is one exception to this rule
+ however: objects with no thread affinity can be "pulled" to the
+ current thread.
\sa thread()
*/