summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-02-24 12:06:09 +0100
committerRoberto Raggi <roberto.raggi@nokia.com>2009-02-24 12:06:34 +0100
commit0220b4519e0ba47bb8dcc5f96c2de9248d812ab7 (patch)
tree5cd1e77604c3e5369700cc6f880022371f1b269f /src
parent5b54d59d23ceccb5f063046675a1b2af6b1bc9f2 (diff)
downloadqt-creator-0220b4519e0ba47bb8dcc5f96c2de9248d812ab7.tar.gz
Cleanup
Diffstat (limited to 'src')
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index b8ab636dbd..e982c8ffb7 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<void> &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<void> &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<void> &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;
}