forked from qt-creator/qt-creator
FileApiReader: Make stopping faster
On the session switch we are busy waiting for the running async task, started before by the FileApiReader::endState(). This blocks the main thread for considerable amount of time. E.g. when switching between sessions both containing Qt project, it may block the main thread up to 10 seconds. Instead, we employ the future synchronizer and move the awaiting to the shutdown phase. The next patch is going to limit the awaiting in shutdown phase. Task-number: QTCREATORBUG-27729 Change-Id: I956ed26edcd699d8a4e2b9309d109963f1d4bb20 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -11,10 +11,13 @@
|
||||
|
||||
#include <coreplugin/messagemanager.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/async.h>
|
||||
#include <utils/futuresynchronizer.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
|
||||
@@ -168,7 +171,7 @@ void FileApiReader::stop()
|
||||
|
||||
if (m_future) {
|
||||
m_future->cancel();
|
||||
m_future->waitForFinished();
|
||||
ExtensionSystem::PluginManager::futureSynchronizer()->addFuture(*m_future);
|
||||
}
|
||||
m_future = {};
|
||||
m_isParsing = false;
|
||||
|
||||
Reference in New Issue
Block a user