summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2021-03-03 10:58:05 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-05 22:36:21 +0000
commit4387b9ffea15d853bdb1df83b2844f134a8e943e (patch)
tree55b1b4b4da5842861a58feae57590f31b481c6db
parente4efa00c72c7011f4e5c27722c2a522b30274610 (diff)
Improve docs for Qt Concurrent run with promise mode
For the readers that are new to QtConcurrent, it may be confusing that unlike the normal usage of QPromise, they don't have to call start() or finish() when using Qt Concurrent run with promise mode. Be more explicit about that. Change-Id: I08df6c4ca41bec4120e208a6643ee20c7adf265c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> (cherry picked from commit fcc453df5cd03a24dad3328d930cc3ef2a1b05ef) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/concurrent/qtconcurrentrun.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp
index 8347440b66..18bcf332ac 100644
--- a/src/concurrent/qtconcurrentrun.cpp
+++ b/src/concurrent/qtconcurrentrun.cpp
@@ -194,6 +194,11 @@
\snippet code/src_concurrent_qtconcurrentrun.cpp 11
+ \note There's no need to call QPromise::start() and QPromise::finish() to
+ indicate the beginning and the end of computation (like you would normally do when
+ using QPromise). QtConcurrent::run() will always call them before starting and
+ after finishing the execution.
+
\section2 Suspending and canceling the execution
The QPromise API also enables suspending and canceling the computation, if requested:
@@ -215,6 +220,10 @@
call to \c promise.isCanceled() will return \c true and
\c aFunction will return immediately without any further result reporting.
+ \note There's no need to call QPromise::finish() to stop the computation
+ after the cancellation (like you would normally do when using QPromise).
+ QtConcurrent::run() will always call it after finishing the execution.
+
\section2 Progress reporting
It's also possible to report the progress of a task