[clang-tools-extra] r295193 - [clangd] Initialize the thread after the mutex.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 15 08:34:58 PST 2017
Author: d0k
Date: Wed Feb 15 10:34:58 2017
New Revision: 295193
URL: http://llvm.org/viewvc/llvm-project?rev=295193&view=rev
Log:
[clangd] Initialize the thread after the mutex.
Otherwise locking the mutex yields a racy assertion failure on picky
implementations.
Modified:
clang-tools-extra/trunk/clangd/ASTManager.h
Modified: clang-tools-extra/trunk/clangd/ASTManager.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ASTManager.h?rev=295193&r1=295192&r2=295193&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ASTManager.h (original)
+++ clang-tools-extra/trunk/clangd/ASTManager.h Wed Feb 15 10:34:58 2017
@@ -57,9 +57,6 @@ private:
CompilationDatabases;
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.
std::deque<std::string> RequestQueue;
/// Setting Done to true will make the worker thread terminate.
@@ -68,6 +65,10 @@ private:
std::condition_variable ClangRequestCV;
/// Lock for accesses to RequestQueue and Done.
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
More information about the cfe-commits
mailing list