We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3043a72 commit c6a1d49Copy full SHA for c6a1d49
clang-tools-extra/clangd/Threading.cpp
@@ -7,6 +7,8 @@
7
#include <thread>
8
#ifdef __USE_POSIX
9
#include <pthread.h>
10
+#elif defined(__APPLE__)
11
+#include <sys/resource.h>
12
#endif
13
14
namespace clang {
@@ -121,6 +123,12 @@ void setCurrentThreadPriority(ThreadPriority Priority) {
121
123
Priority == ThreadPriority::Low && !AvoidThreadStarvation ? SCHED_IDLE
122
124
: SCHED_OTHER,
125
&priority);
126
127
+ // https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getpriority.2.html
128
+ setpriority(PRIO_DARWIN_THREAD, 0,
129
+ Priority == ThreadPriority::Low && !AvoidThreadStarvation
130
+ ? PRIO_DARWIN_BG
131
+ : 0);
132
133
}
134
0 commit comments