From 0220b4519e0ba47bb8dcc5f96c2de9248d812ab7 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Tue, 24 Feb 2009 12:06:09 +0100 Subject: [PATCH] Cleanup --- src/plugins/cpptools/cppmodelmanager.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index b8ab636dbd9..e982c8ffb7b 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -281,7 +281,9 @@ void CppPreprocessor::resetEnvironment() void CppPreprocessor::parseCollectedDocuments() { + QThread::currentThread()->setPriority(QThread::IdlePriority); QtConcurrent::blockingMap(m_documents, Process(m_modelManager)); + QThread::currentThread()->setPriority(QThread::NormalPriority); m_documents.clear(); } @@ -947,13 +949,9 @@ void CppModelManager::parse(QFutureInterface &future, preproc->setTodo(files); - // Change the priority of the background parser thread to idle. - QThread::currentThread()->setPriority(QThread::IdlePriority); - future.setProgressRange(0, files.size()); QString conf = QLatin1String(pp_configuration_file); - const int STEP = 10; bool processingHeaders = false; @@ -964,10 +962,8 @@ void CppModelManager::parse(QFutureInterface &future, if (future.isCanceled()) break; -#ifdef CPPTOOLS_DEBUG_PARSING_TIME - QTime tm; - tm.start(); -#endif + // Change the priority of the background parser thread to idle. + QThread::currentThread()->setPriority(QThread::IdlePriority); QString fileName = files.at(i); @@ -991,21 +987,14 @@ void CppModelManager::parse(QFutureInterface &future, if (isSourceFile) preproc->resetEnvironment(); - if (! (i % STEP)) // Yields execution of the current thread. - QThread::yieldCurrentThread(); - -#ifdef CPPTOOLS_DEBUG_PARSING_TIME - qDebug() << fileName << "parsed in:" << tm.elapsed(); -#endif + // Restore the previous thread priority. + QThread::currentThread()->setPriority(QThread::NormalPriority); } preproc->parseCollectedDocuments(); future.setProgressValue(files.size()); - // Restore the previous thread priority. - QThread::currentThread()->setPriority(QThread::NormalPriority); - delete preproc; }