mirror of
https://github.com/MaskRay/ccls.git
synced 2025-06-14 12:12:20 +00:00
correctly grabbing the ownership of index files.
This commit is contained in:
parent
431eef2167
commit
dacce74706
@ -194,6 +194,14 @@ bool Indexer_Parse(DiagnosticsPublisher *diag_pub, WorkingFiles *working_files,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// grab the ownership
|
||||||
|
if (reparse)
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(vfs->mutex);
|
||||||
|
vfs->state[path_to_index].owner = g_thread_id;
|
||||||
|
vfs->state[path_to_index].stage = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (reparse < 2) {
|
if (reparse < 2) {
|
||||||
LOG_S(INFO) << "load cache for " << path_to_index;
|
LOG_S(INFO) << "load cache for " << path_to_index;
|
||||||
auto dependencies = prev->dependencies;
|
auto dependencies = prev->dependencies;
|
||||||
@ -207,11 +215,6 @@ bool Indexer_Parse(DiagnosticsPublisher *diag_pub, WorkingFiles *working_files,
|
|||||||
IndexUpdate update = IndexUpdate::CreateDelta(nullptr, prev.get());
|
IndexUpdate update = IndexUpdate::CreateDelta(nullptr, prev.get());
|
||||||
on_indexed->PushBack(std::move(update), request.is_interactive);
|
on_indexed->PushBack(std::move(update), request.is_interactive);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(vfs->mutex);
|
|
||||||
VFS::State &state = vfs->state[path_to_index];
|
|
||||||
if (state.owner == g_thread_id)
|
|
||||||
state.stage = 0;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user