src: Fixed FileRegisterStateData synchronisation
This commit is contained in:
@@ -49,7 +49,7 @@ FileRegister::~FileRegister()
|
||||
{
|
||||
}
|
||||
|
||||
FileRegisterStateData FileRegister::getStateData() const
|
||||
const FileRegisterStateData& FileRegister::getStateData() const
|
||||
{
|
||||
return m_stateData;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
FileRegister(const FileRegisterStateData& stateData, const std::set<FilePath>& indexedPaths, const std::set<FilePath>& excludedPaths);
|
||||
virtual ~FileRegister();
|
||||
|
||||
FileRegisterStateData getStateData() const;
|
||||
const FileRegisterStateData& getStateData() const;
|
||||
|
||||
void markFileIndexing(const FilePath& filePath);
|
||||
void markIndexingFilesIndexed();
|
||||
|
||||
@@ -25,21 +25,13 @@ void FileRegisterStateData::inject(const FileRegisterStateData& o)
|
||||
void FileRegisterStateData::markFileIndexing(const FilePath& filePath)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_filePathsMutex);
|
||||
auto it = m_filePaths.find(filePath);
|
||||
if (it != m_filePaths.end())
|
||||
{
|
||||
it->second = STATE_INDEXING;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_filePaths.insert(std::make_pair(filePath, STATE_INDEXING));
|
||||
}
|
||||
m_filePaths[filePath] = STATE_INDEXING;
|
||||
}
|
||||
|
||||
void FileRegisterStateData::markIndexingFilesIndexed()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_filePathsMutex);
|
||||
for (auto it: m_filePaths)
|
||||
for (auto& it: m_filePaths)
|
||||
{
|
||||
if (it.second == STATE_INDEXING)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user