diff options
Diffstat (limited to 'qmake/library/qmakeparser.cpp')
-rw-r--r-- | qmake/library/qmakeparser.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp index 3fd7957bc0..95a072392e 100644 --- a/qmake/library/qmakeparser.cpp +++ b/qmake/library/qmakeparser.cpp @@ -64,6 +64,18 @@ void ProFileCache::discardFile(const QString &fileName) #endif QHash<QString, Entry>::Iterator it = parsed_files.find(fileName); if (it != parsed_files.end()) { +#ifdef PROPARSER_THREAD_SAFE + if (it->locker) { + if (!it->locker->done) { + ++it->locker->waiters; + it->locker->cond.wait(&mutex); + if (!--it->locker->waiters) { + delete it->locker; + it->locker = 0; + } + } + } +#endif if (it->pro) it->pro->deref(); parsed_files.erase(it); @@ -80,6 +92,18 @@ void ProFileCache::discardFiles(const QString &prefix) end = parsed_files.end(); while (it != end) if (it.key().startsWith(prefix)) { +#ifdef PROPARSER_THREAD_SAFE + if (it->locker) { + if (!it->locker->done) { + ++it->locker->waiters; + it->locker->cond.wait(&mutex); + if (!--it->locker->waiters) { + delete it->locker; + it->locker = 0; + } + } + } +#endif if (it->pro) it->pro->deref(); it = parsed_files.erase(it); @@ -88,7 +112,6 @@ void ProFileCache::discardFiles(const QString &prefix) } } - ////////// Parser /////////// #define fL1S(s) QString::fromLatin1(s) |