forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user