Skip to content

Commit

Permalink
Improve docs for Qt Concurrent run with promise mode
Browse files Browse the repository at this point in the history
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.

Pick-to: 6.1
Change-Id: I08df6c4ca41bec4120e208a6643ee20c7adf265c
Reviewed-by: Jarek Kobus <[email protected]>
Reviewed-by: Leena Miettinen <[email protected]>
  • Loading branch information
Sona Kurazyan committed Mar 4, 2021
1 parent b627256 commit fcc453d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/concurrent/qtconcurrentrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit fcc453d

Please sign in to comment.