[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 06:13:43 PST 2018


ilya-biryukov added inline comments.


================
Comment at: clangd/Threading.h:125
+// Sets scheduling priority for the calling thread.
+void setThreadPriority(ThreadPriority Priority);
 // Avoid the use of scheduler policies that may starve low-priority threads.
----------------
Maybe change the name to `setCurrentThreadPrority`?
The change itself LG, there does not seem to be a way to get the native handle from `std::this_thread`...


================
Comment at: clangd/index/Background.cpp:190
+          // this to support tasks with various priorities.
+          setThreadPriority(ThreadPriority::Low);
           Cmd.CommandLine.push_back("-resource-dir=" + ResourceDir);
----------------
Maybe make this a parameter of `enqueueTask`, probably with `ThreadPriority::Low` being the default?
Seems to be an appropriate place, `enqueueTask` is a starting point for scheduling and task priority is inherently a property that the scheduler cares about.


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