mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-23 08:05:07 +00:00
Spin IncludeComplete's destructor until scanning completes (#147)
This commit is contained in:
parent
4416a258ae
commit
e53a1aba97
@ -90,6 +90,12 @@ CompletionItem BuildCompletionItem(const std::string &path,
|
|||||||
IncludeComplete::IncludeComplete(Project *project)
|
IncludeComplete::IncludeComplete(Project *project)
|
||||||
: is_scanning(false), project_(project) {}
|
: is_scanning(false), project_(project) {}
|
||||||
|
|
||||||
|
IncludeComplete::~IncludeComplete() {
|
||||||
|
// Spin until the scanning has completed.
|
||||||
|
while (is_scanning.load())
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
}
|
||||||
|
|
||||||
void IncludeComplete::Rescan() {
|
void IncludeComplete::Rescan() {
|
||||||
if (is_scanning || LLVM_VERSION_MAJOR >= 8)
|
if (is_scanning || LLVM_VERSION_MAJOR >= 8)
|
||||||
return;
|
return;
|
||||||
|
@ -14,6 +14,7 @@ struct Project;
|
|||||||
|
|
||||||
struct IncludeComplete {
|
struct IncludeComplete {
|
||||||
IncludeComplete(Project *project);
|
IncludeComplete(Project *project);
|
||||||
|
~IncludeComplete();
|
||||||
|
|
||||||
// Starts scanning directories. Clears existing cache.
|
// Starts scanning directories. Clears existing cache.
|
||||||
void Rescan();
|
void Rescan();
|
||||||
|
Loading…
Reference in New Issue
Block a user