From 50f507eb4466400dc5dd74fb9f670cb6ec307d75 Mon Sep 17 00:00:00 2001 From: Safiyyah Moosa Date: Mon, 21 Oct 2024 23:33:52 +0200 Subject: [PATCH] Doc: Clarify run() and started() order in QThread This fix addresses a customer suggestion to clarify the QThread() documentation. It now states that started() is emitted by the newly started thread, so any slots connected to it will occur by queued invocation. For clarity purposes, an additional sentence has been added to state that whilst the event may have been posted before run() is called, cross-thread delivery of the signal may still be pending. A link to 'Signals and Slots Across Threads' has also been added. Fixes: QTBUG-112221 Pick-to: 6.7 6.5 Change-Id: Id502eb4bf48b745af4d9906d7cd05de73d2b6418 Reviewed-by: Thiago Macieira Reviewed-by: Paul Wicking (cherry picked from commit 371872af23c1c9f9b3b56dd191fb13f850615dd4) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/thread/qthread.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index ee947c0c5f8..edfb77f1cf4 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -371,9 +371,12 @@ QThreadPrivate::~QThreadPrivate() \fn void QThread::started() This signal is emitted from the associated thread when it starts executing, - before the run() function is called. + so any slots connected to it may be called via queued invocation. Whilst + the event may have been posted before run() is called, any + \l {Signals and Slots Across Threads} {cross-thread delivery} of the signal + may still be pending. - \sa finished() + \sa run(), finished() */ /*!