summaryrefslogtreecommitdiffstats
path: root/clangd/Threading.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clangd/Threading.cpp')
-rw-r--r--clangd/Threading.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/clangd/Threading.cpp b/clangd/Threading.cpp
index 139fcc2f..016a9029 100644
--- a/clangd/Threading.cpp
+++ b/clangd/Threading.cpp
@@ -7,6 +7,10 @@
#include <thread>
#ifdef __USE_POSIX
#include <pthread.h>
+#elif defined(__APPLE__)
+#include <sys/resource.h>
+#elif defined (_WIN32)
+#include <windows.h>
#endif
namespace clang {
@@ -109,22 +113,5 @@ void wait(std::unique_lock<std::mutex> &Lock, std::condition_variable &CV,
CV.wait_until(Lock, D.time());
}
-static std::atomic<bool> AvoidThreadStarvation = {false};
-
-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(
- pthread_self(),
- Priority == ThreadPriority::Low && !AvoidThreadStarvation ? SCHED_IDLE
- : SCHED_OTHER,
- &priority);
-#endif
-}
-
-void preventThreadStarvationInTests() { AvoidThreadStarvation = true; }
-
} // namespace clangd
} // namespace clang