[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 5 11:00:42 PST 2018


ilya-biryukov added inline comments.


================
Comment at: clangd/Threading.h:124
 };
-void setThreadPriority(std::thread &T, ThreadPriority Priority);
+// Sets scheduling priority for the calling thread.
+void setCurrentThreadPriority(ThreadPriority Priority);
----------------
The comment looks redundant now. Maybe remove it?


================
Comment at: clangd/index/Background.cpp:202
     std::lock_guard<std::mutex> Lock(QueueMu);
-    Queue.push_back(std::move(T));
+    if (Priority == ThreadPriority::Low) {
+      Queue.push_back(Bind(
----------------
Since we might be interested in scheduling higher-priority tasks first anyway (not in this patch, but still), maybe store a pair of `(Task, Priority)` in the queue and call `setCurrentThreadPriority` when actually running the task?


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D55315





More information about the cfe-commits mailing list