diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.pro b/src/plugins/qt4projectmanager/qt4projectmanager.pro index 448067a9e85c7b191a562237e505ae31bb0aafc1..f4c492ac33b7189a631d9b4a1d4caa263de35912 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.pro +++ b/src/plugins/qt4projectmanager/qt4projectmanager.pro @@ -96,7 +96,7 @@ FORMS += makestep.ui \ wizards/targetsetuppage.ui RESOURCES += qt4projectmanager.qrc \ wizards/wizards.qrc -DEFINES += PROPARSER_THREAD_SAFE +DEFINES += PROPARSER_THREAD_SAFE PROEVALUATOR_THREAD_SAFE include(../../shared/proparser/proparser.pri) include(qt-s60/qt-s60.pri) include(qt-maemo/qt-maemo.pri) diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 07717953b670030b05f20233687895cc645d4f90..b4788904b0dbeab1799a28e41e687e9feb398680 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -161,6 +161,10 @@ ProFileOption::ProFileOption() #endif cache = 0; + +#ifdef PROEVALUATOR_THREAD_SAFE + base_inProgress = false; +#endif } ProFileOption::~ProFileOption() @@ -1270,7 +1274,21 @@ ProItem::ProItemReturn ProFileEvaluator::Private::visitProFile(ProFile *pro) if (m_parsePreAndPostFiles) { +#ifdef PROEVALUATOR_THREAD_SAFE + { + QMutexLocker locker(&m_option->mutex); + if (m_option->base_inProgress) { + QThreadPool::globalInstance()->releaseThread(); + m_option->cond.wait(&m_option->mutex); + QThreadPool::globalInstance()->reserveThread(); + } else +#endif if (m_option->base_valuemap.isEmpty()) { +#ifdef PROEVALUATOR_THREAD_SAFE + m_option->base_inProgress = true; + locker.unlock(); +#endif + // ### init QMAKE_QMAKE, QMAKE_SH // ### init QMAKE_EXT_{C,H,CPP,OBJ} // ### init TEMPLATE_PREFIX @@ -1377,7 +1395,16 @@ ProItem::ProItemReturn ProFileEvaluator::Private::visitProFile(ProFile *pro) evaluateFeatureFile(QLatin1String("default_pre.prf"), &m_option->base_valuemap, &m_option->base_functions); + +#ifdef PROEVALUATOR_THREAD_SAFE + locker.relock(); + m_option->base_inProgress = false; + m_option->cond.wakeAll(); +#endif } +#ifdef PROEVALUATOR_THREAD_SAFE + } +#endif m_valuemapStack.top() = m_option->base_valuemap; diff --git a/src/shared/proparser/profileevaluator.h b/src/shared/proparser/profileevaluator.h index e4acafdd36aa898a2b2cf645569847e61a765165..57df396d5a0e8c54708e9d8bf00c944533647edf 100644 --- a/src/shared/proparser/profileevaluator.h +++ b/src/shared/proparser/profileevaluator.h @@ -182,6 +182,11 @@ struct ProFileOption ProFileEvaluator::FunctionDefs base_functions; QStringList feature_roots; QString qmakespec_name; +#ifdef PROEVALUATOR_THREAD_SAFE + QMutex mutex; + QWaitCondition cond; + bool base_inProgress; +#endif }; QT_END_NAMESPACE