MapReduce: Optimize cancelling between thread start and exec() call

The existing logic works because the future watcher gets the canceled
signal even if the future was canceled before connecting the watcher and
starting the loop, and we schedule jobs before we start the loop and the
watcher gets the signal. But it is still better to avoid scheduling
anything at all in this case.

Change-Id: I3fa722bdd8391de7c7f3ba3fd8b1aaa65d9d2392
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2017-03-20 11:43:50 +01:00
parent 9d8f4c3a0d
commit 7694c718db

View File

@@ -77,7 +77,8 @@ public:
void exec()
{
if (schedule()) // do not enter event loop for empty containers
// do not enter event loop for empty containers or if already canceled
if (!m_futureInterface.isCanceled() && schedule())
m_loop.exec();
}