forked from qt-creator/qt-creator
QMakeProjectManager: Avoid usage of global thread pool.
Using a global thread pool does not really make sense, since we do not want to block any completely unrelated task. But the qmake project manager still wants to limit the number of simultaneous threads without managing that itself. A shared thread pool in project explorer sounds like a sensible middle ground. Change-Id: Ide6fd546a56e8f4896c387168513b608dfe7e3e8 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -139,6 +139,7 @@
|
||||
#include <QFileDialog>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QThreadPool>
|
||||
#include <QTimer>
|
||||
|
||||
/*!
|
||||
@@ -368,6 +369,7 @@ public:
|
||||
#ifdef WITH_JOURNALD
|
||||
JournaldWatcher *m_journalWatcher;
|
||||
#endif
|
||||
QThreadPool m_threadPool;
|
||||
};
|
||||
|
||||
ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
|
||||
@@ -1852,6 +1854,11 @@ void ProjectExplorerPlugin::updateContextMenuActions()
|
||||
dd->updateContextMenuActions();
|
||||
}
|
||||
|
||||
QThreadPool *ProjectExplorerPlugin::sharedThreadPool()
|
||||
{
|
||||
return &(dd->m_threadPool);
|
||||
}
|
||||
|
||||
/*!
|
||||
This function is connected to the ICore::coreOpened signal. If
|
||||
there was no session explicitly loaded, it creates an empty new
|
||||
|
@@ -37,6 +37,7 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPoint;
|
||||
class QAction;
|
||||
class QThreadPool;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
@@ -154,6 +155,8 @@ public:
|
||||
|
||||
static void updateContextMenuActions();
|
||||
|
||||
static QThreadPool *sharedThreadPool();
|
||||
|
||||
private:
|
||||
static bool coreAboutToClose();
|
||||
|
||||
|
@@ -1800,7 +1800,9 @@ void QmakeProFileNode::asyncUpdate()
|
||||
m_readerExact->setExact(false);
|
||||
m_parseFutureWatcher.waitForFinished();
|
||||
EvalInput input = evalInput();
|
||||
QFuture<EvalResult *> future = QtConcurrent::run(&QmakeProFileNode::asyncEvaluate, this, input);
|
||||
QFuture<EvalResult *> future = Utils::runAsync<EvalResult *>(ProjectExplorerPlugin::sharedThreadPool(),
|
||||
&QmakeProFileNode::asyncEvaluate,
|
||||
this, input);
|
||||
m_parseFutureWatcher.setFuture(future);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user