This commit is contained in:
Roberto Raggi
2009-02-24 12:06:09 +01:00
parent 5b54d59d23
commit 0220b4519e

View File

@@ -281,7 +281,9 @@ void CppPreprocessor::resetEnvironment()
void CppPreprocessor::parseCollectedDocuments() void CppPreprocessor::parseCollectedDocuments()
{ {
QThread::currentThread()->setPriority(QThread::IdlePriority);
QtConcurrent::blockingMap(m_documents, Process(m_modelManager)); QtConcurrent::blockingMap(m_documents, Process(m_modelManager));
QThread::currentThread()->setPriority(QThread::NormalPriority);
m_documents.clear(); m_documents.clear();
} }
@@ -947,13 +949,9 @@ void CppModelManager::parse(QFutureInterface<void> &future,
preproc->setTodo(files); preproc->setTodo(files);
// Change the priority of the background parser thread to idle.
QThread::currentThread()->setPriority(QThread::IdlePriority);
future.setProgressRange(0, files.size()); future.setProgressRange(0, files.size());
QString conf = QLatin1String(pp_configuration_file); QString conf = QLatin1String(pp_configuration_file);
const int STEP = 10;
bool processingHeaders = false; bool processingHeaders = false;
@@ -964,10 +962,8 @@ void CppModelManager::parse(QFutureInterface<void> &future,
if (future.isCanceled()) if (future.isCanceled())
break; break;
#ifdef CPPTOOLS_DEBUG_PARSING_TIME // Change the priority of the background parser thread to idle.
QTime tm; QThread::currentThread()->setPriority(QThread::IdlePriority);
tm.start();
#endif
QString fileName = files.at(i); QString fileName = files.at(i);
@@ -991,21 +987,14 @@ void CppModelManager::parse(QFutureInterface<void> &future,
if (isSourceFile) if (isSourceFile)
preproc->resetEnvironment(); preproc->resetEnvironment();
if (! (i % STEP)) // Yields execution of the current thread. // Restore the previous thread priority.
QThread::yieldCurrentThread(); QThread::currentThread()->setPriority(QThread::NormalPriority);
#ifdef CPPTOOLS_DEBUG_PARSING_TIME
qDebug() << fileName << "parsed in:" << tm.elapsed();
#endif
} }
preproc->parseCollectedDocuments(); preproc->parseCollectedDocuments();
future.setProgressValue(files.size()); future.setProgressValue(files.size());
// Restore the previous thread priority.
QThread::currentThread()->setPriority(QThread::NormalPriority);
delete preproc; delete preproc;
} }