[PATCH] D36261: [clangd] Use multiple working threads in clangd.

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 06:09:22 PDT 2017


krasimir added a comment.

Great!



================
Comment at: clangd/ClangdServer.h:131
+
 /// Handles running WorkerRequests of ClangdServer on a separate threads.
 /// Currently runs only one worker thread.
----------------
typo: "on separate threads"


================
Comment at: clangd/ClangdServer.h:176
   std::mutex Mutex;
   /// We run some tasks on a separate threads(parsing, CppFile cleanup).
   /// This thread looks into RequestQueue to find requests to handle and
----------------
typo: "on separate threads"


================
Comment at: clangd/tool/ClangdMain.cpp:24
 
-static llvm::cl::opt<bool>
-    RunSynchronously("run-synchronously",
-                     llvm::cl::desc("Parse on main thread"),
-                     llvm::cl::init(false), llvm::cl::Hidden);
+static unsigned getDefaultThreadsCount() {
+  unsigned HardwareConcurrency = std::thread::hardware_concurrency();
----------------
Extract this somewhere when it can be reused both by this and in `clangd/ClangdServer.cpp:90`.


================
Comment at: clangd/tool/ClangdMain.cpp:69
+  SchedulingOptions SchedOpts =
+      !RunSynchronously ? SchedulingOptions::RunOnWorkerThreads(ThreadsCount)
+                        : SchedulingOptions::RunOnCallingThread();
----------------
Consider inverting this condition.


https://reviews.llvm.org/D36261





More information about the cfe-commits mailing list