diff options
| author | Kadir Cetinkaya <kadircet@google.com> | 2018-12-17 12:30:27 +0000 |
|---|---|---|
| committer | Kadir Cetinkaya <kadircet@google.com> | 2018-12-17 12:30:27 +0000 |
| commit | 375c54fd1e8833570013d6f44e7bd09dc87d7211 (patch) | |
| tree | 2e047c36be01801f69235dfef1af1c3810b7cf2f /clang-tools-extra/clangd/Threading.cpp | |
| parent | 9af1d2d10f1fc4c6bc46656441926a3d0a7fc7ae (diff) | |
| download | bcm5719-llvm-375c54fd1e8833570013d6f44e7bd09dc87d7211.tar.gz bcm5719-llvm-375c54fd1e8833570013d6f44e7bd09dc87d7211.zip | |
[clangd] Only reduce priority of a thread for indexing.
Summary:
We'll soon have tasks pending for reading shards from disk, we want
them to have normal priority. Because:
- They are not CPU intensive, mostly IO bound.
- Give a good coverage for the project at startup, therefore it is worth
spending some cycles.
- We have only one task per whole CDB rather than one task per file.
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D55315
llvm-svn: 349345
Diffstat (limited to 'clang-tools-extra/clangd/Threading.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/Threading.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/Threading.cpp b/clang-tools-extra/clangd/Threading.cpp index cfb5e02a3f3..abfe0f497ca 100644 --- a/clang-tools-extra/clangd/Threading.cpp +++ b/clang-tools-extra/clangd/Threading.cpp @@ -112,13 +112,13 @@ void wait(std::unique_lock<std::mutex> &Lock, std::condition_variable &CV, static std::atomic<bool> AvoidThreadStarvation = {false}; -void setThreadPriority(std::thread &T, ThreadPriority Priority) { +void setCurrentThreadPriority(ThreadPriority Priority) { // Some *really* old glibcs are missing SCHED_IDLE. #if defined(__linux__) && defined(SCHED_IDLE) sched_param priority; priority.sched_priority = 0; pthread_setschedparam( - T.native_handle(), + pthread_self(), Priority == ThreadPriority::Low && !AvoidThreadStarvation ? SCHED_IDLE : SCHED_OTHER, &priority); |

