Index: clangd/Threading.cpp =================================================================== --- clangd/Threading.cpp +++ clangd/Threading.cpp @@ -7,6 +7,8 @@ #include #ifdef __USE_POSIX #include +#elif defined(__APPLE__) +#include #endif namespace clang { @@ -121,6 +123,12 @@ Priority == ThreadPriority::Low && !AvoidThreadStarvation ? SCHED_IDLE : SCHED_OTHER, &priority); +#elif defined(__APPLE__) + // https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getpriority.2.html + setpriority(PRIO_DARWIN_THREAD, 0, + Priority == ThreadPriority::Low && !AvoidThreadStarvation + ? PRIO_DARWIN_BG + : 0); #endif }