summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-12-23 16:23:45 +0100
committerIvan Solovev <ivan.solovev@qt.io>2023-01-09 10:03:48 +0100
commita8261e327d6316d944cfcc312a1b2e71bd4e5d27 (patch)
treecd8e49af5e838e27ad9227311009741091c96d1c /src/corelib/thread
parent8a30b22930d3a3d15fba97ff7aec7f812721869e (diff)
QPromise: improve documentation snippet
The multi-thread snippet in the documentation, when copied as is, could actually crash because of the race condition between the main thread and the thread that generate results for the promise. This is fixed by explicitly calling QPromise::start(). Actually, the underlying snippet already has this call, it just was not included in the documentation. This patch modifies the documentation snippet to include calls to both QPromise::start() and QPromise::finish(). Fixes: QTBUG-109230 Pick-to: 6.5 6.4 6.2 Change-Id: Ic25f31a6b3b16ba6bc06a0b199289c8c5d50bab6 Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qpromise.qdoc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/thread/qpromise.qdoc b/src/corelib/thread/qpromise.qdoc
index 144ad16974..37ffa8485e 100644
--- a/src/corelib/thread/qpromise.qdoc
+++ b/src/corelib/thread/qpromise.qdoc
@@ -38,6 +38,8 @@
\snippet snippet_qpromise.cpp multithread_init
\codeline
\snippet snippet_qpromise.cpp multithread_main
+ \codeline
+ \snippet snippet_qpromise.cpp multithread_cleanup
\sa QFuture
*/