forked from OSchip/llvm-project
[clangd] Initialize the thread after the mutex.
Otherwise locking the mutex yields a racy assertion failure on picky implementations. llvm-svn: 295193
This commit is contained in:
parent
a3bc480455
commit
3858b7d6e9
|
@ -57,9 +57,6 @@ private:
|
||||||
CompilationDatabases;
|
CompilationDatabases;
|
||||||
std::shared_ptr<clang::PCHContainerOperations> PCHs;
|
std::shared_ptr<clang::PCHContainerOperations> PCHs;
|
||||||
|
|
||||||
/// We run parsing on a separate thread. This thread looks into PendingRequest
|
|
||||||
/// as a 'one element work queue' as long as RequestIsPending is true.
|
|
||||||
std::thread ClangWorker;
|
|
||||||
/// Queue of requests.
|
/// Queue of requests.
|
||||||
std::deque<std::string> RequestQueue;
|
std::deque<std::string> RequestQueue;
|
||||||
/// Setting Done to true will make the worker thread terminate.
|
/// Setting Done to true will make the worker thread terminate.
|
||||||
|
@ -68,6 +65,10 @@ private:
|
||||||
std::condition_variable ClangRequestCV;
|
std::condition_variable ClangRequestCV;
|
||||||
/// Lock for accesses to RequestQueue and Done.
|
/// Lock for accesses to RequestQueue and Done.
|
||||||
std::mutex RequestLock;
|
std::mutex RequestLock;
|
||||||
|
|
||||||
|
/// We run parsing on a separate thread. This thread looks into PendingRequest
|
||||||
|
/// as a 'one element work queue' as the queue is non-empty.
|
||||||
|
std::thread ClangWorker;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace clangd
|
} // namespace clangd
|
||||||
|
|
Loading…
Reference in New Issue