qt6-bb10/src
Sona Kurazyan dfaca09e85 Add support for attaching continuations to QFuture
Added QFuture::then() methods to allow chaining multiple asynchronous
computations.

Continuations can use the following execution policies:

* QtFuture::Launch::Sync - the continuation will be launched in the same
thread in which the parent has been executing.

* QtFuture::Launch::Async - the continuation will be launched in a new
thread.

* QtFuture::Launch::Inherit - the continuation will inherit the launch
policy of the parent, or its thread pool (if it was using a custom one).

* Additionally then() also accepts a custom QThreadPool* instance.

Note, that if the parent future gets canceled, its continuation(s) will
be also canceled.

If the parent throws an exception, it will be propagated to the
continuation's future, unless it is caught inside the continuation
(if it has a QFuture arg).

Some example usages:

 QFuture<int> future = ...;
 future.then([](int res1){ ... }).then([](int res2){ ... })...

 QFuture<int> future = ...;
 future.then([](QFuture<int> fut1){ /* do something with fut1 */ })...

In the examples above all continuations will run in the same thread as
future.

 QFuture<int> future = ...;
 future.then(QtFuture::Launch::Async, [](int res1){ ... })
       .then([](int res2){ ... })..

In this example the continuations will run in a new thread (but on the
same one).

 QThreadPool pool;
 QFuture<int> future = ...;
 future.then(&pool, [](int res1){ ... })
       .then([](int res2){ ... })..

In this example the continuations will run in the given thread pool.

[ChangeLog][QtCore] Added support for attaching continuations to QFuture.

Task-number: QTBUG-81587
Change-Id: I5b2e176694f7ae8ce00404aca725e9a170818955
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-05 13:24:32 +01:00
..
3rdparty Update to Harfbuzz 2.6.4 2020-03-04 08:28:04 +01:00
android Finally remove splash.xml to fix a lint warning 2020-03-04 16:31:13 +01:00
angle Disable debug-and-release builds for MinGW 2019-09-18 06:28:16 +00:00
concurrent QtConcurrent: filter- and map-reduce with initial value 2020-03-04 17:40:45 +01:00
corelib Add support for attaching continuations to QFuture 2020-03-05 13:24:32 +01:00
dbus Merge remote-tracking branch 'origin/5.15' into dev 2020-03-03 14:13:02 +01:00
gui Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-03-04 19:10:37 +00:00
network Merge remote-tracking branch 'origin/5.15' into dev 2020-03-04 14:39:18 +00:00
opengl Move QOpenGLBuffer from QtGui to QtOpenGL 2020-02-22 02:08:26 +01:00
openglextensions Merge "Merge remote-tracking branch 'origin/dev' into wip/cmake" into wip/cmake 2019-11-25 14:49:13 +00:00
openglwidgets Docs: Remove lenghty comparison with QGLWidget 2020-02-20 16:11:01 +01:00
platformheaders Merge remote-tracking branch 'origin/dev' into merge-dev 2020-01-24 13:17:33 +01:00
platformsupport Merge remote-tracking branch 'origin/5.15' into dev 2020-03-03 14:13:02 +01:00
plugins Merge remote-tracking branch 'origin/5.15' into dev 2020-03-04 14:39:18 +00:00
printsupport Pass QDate and QTime as value classes 2020-02-27 10:48:25 +01:00
sql Merge remote-tracking branch 'origin/5.15' into dev 2020-02-28 09:48:30 +01:00
testlib Merge remote-tracking branch 'origin/5.15' into dev 2020-02-26 18:39:21 +01:00
tools Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-03-04 19:10:37 +00:00
widgets Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-03-04 19:10:37 +00:00
winmain Regenerate src/* 2019-11-14 09:05:48 +00:00
xml Merge remote-tracking branch 'origin/5.15' into dev 2020-02-26 18:39:21 +01:00
CMakeLists.txt CMake: Allow building bundled 3rd party libraries in qtbase 2020-02-25 15:43:16 +01:00
src.pro Move QOpenGLWidget from QtOpenGL to its own module 2020-02-18 09:22:51 +01:00