07d6d31a4c
This patch relaxes the requirements on the context object of continuations. Instead of having to stay alive during execution of the whole chain, it now only has to stay alive during setup of the chain. If the context object is destroyed before the chain finishes, the respective future is canceled. This patch works by using QFutureCallOutInterface and signals instead of direct invocation of the continuation by the parent future, similar to how QFutureWatcher is implemented. If a continuation is used with a context object, a QBasicFutureWatcher is connected to the QFuture via a QFutureCallOutInterface. When the future finishes, QBasicFutureWatcher::finished() triggers the continuation with a signal/slot connection. This way, we require the context object to stay alive only during setup; the required synchronization is guaranteed by the existing event and signal-slot mechanisms. The continuation itself does not need to know about the context object anymore. [ChangeLog][QtCore][QFuture] Added support for context objects of continuations being destroyed before the continuation finishes. In these cases the future is cancelled immediately. Fixes: QTBUG-112958 Change-Id: Ie0ef3470b2a0ccfa789d2ae7604b92e509c14591 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> |
||
---|---|---|
.. | ||
qatomicint | ||
qatomicinteger | ||
qatomicpointer | ||
qfuture | ||
qfuturesynchronizer | ||
qfuturewatcher | ||
qmutex | ||
qmutexlocker | ||
qpromise | ||
qreadlocker | ||
qreadwritelock | ||
qresultstore | ||
qsemaphore | ||
qthread | ||
qthreadonce | ||
qthreadpool | ||
qthreadstorage | ||
qwaitcondition | ||
qwritelocker | ||
CMakeLists.txt |