[PATCH] D61724: [clangd] Use AsyncTaskRunner in BackgroundIndex instead of std::thread

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 04:36:18 PDT 2019


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: clang-tools-extra/clangd/index/Background.cpp:152
+  for (unsigned I = 1; I <= ThreadPoolSize; ++I) {
+    ThreadPool.runAsync("background-worker-" + llvm::Twine(I),
+                        [this] { run(); });
----------------
NIT: why not count from zero :P


================
Comment at: clang-tools-extra/clangd/index/Background.cpp:164
   stop();
-  for (auto &Thread : ThreadPool)
-    Thread.join();
+  ThreadPool.wait();
 }
----------------
Destructor of `AsyncTaskRunner` already does that


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61724/new/

https://reviews.llvm.org/D61724





More information about the cfe-commits mailing list