diff --git a/src/lib/utility/file/FileRegister.cpp b/src/lib/utility/file/FileRegister.cpp index e7a03c48..0af1ef2a 100644 --- a/src/lib/utility/file/FileRegister.cpp +++ b/src/lib/utility/file/FileRegister.cpp @@ -99,46 +99,44 @@ bool FileRegister::fileIsParsed(const FilePath& filePath) const bool FileRegister::sourceFileIsParsed(const FilePath& filePath) const { + std::lock_guard lock(m_sourceFileMutex); + + std::map::const_iterator it = m_sourceFilePaths.find(filePath); + if (it == m_sourceFilePaths.end()) { - std::lock_guard lock(m_sourceFileMutex); - - std::map::const_iterator it = m_sourceFilePaths.find(filePath); - if (it == m_sourceFilePaths.end()) - { - return false; - } - - if (it->second == STATE_PARSED) - { - return true; - } - return false; } + + if (it->second == STATE_PARSED) + { + return true; + } + + return false; } bool FileRegister::includeFileIsParsed(const FilePath& filePath) const { + std::lock_guard lock(m_includeFileMutex); + + std::map::const_iterator it = m_includeFilePaths.find(filePath); + if (it == m_includeFilePaths.end()) { - std::lock_guard lock(m_includeFileMutex); - - std::map::const_iterator it = m_includeFilePaths.find(filePath); - if (it == m_includeFilePaths.end()) - { - return false; - } - - if (it->second == STATE_PARSED) - { - return true; - } - return false; } + + if (it->second == STATE_PARSED) + { + return true; + } + + return false; } FilePath FileRegister::consumeSourceFile() { + std::lock_guard lock(m_consumeFileMutex); + std::vector paths = getUnparsedSourceFilePaths(); FilePath path; diff --git a/src/lib/utility/file/FileRegister.h b/src/lib/utility/file/FileRegister.h index 401204c5..6f7e0535 100644 --- a/src/lib/utility/file/FileRegister.h +++ b/src/lib/utility/file/FileRegister.h @@ -65,7 +65,8 @@ private: mutable std::mutex m_sourceFileMutex; mutable std::mutex m_includeFileMutex; mutable std::mutex m_threadFileMutex; - mutable std::mutex m_fileManagerMutex; + + std::mutex m_consumeFileMutex; }; #endif // FILE_REGISTER_H