diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc index 99f64b4f553d..5de1cf071ba9 100644 --- a/llvm/lib/Support/Unix/Threading.inc +++ b/llvm/lib/Support/Unix/Threading.inc @@ -18,7 +18,6 @@ #if defined(__APPLE__) #include #include -#include #endif #include @@ -276,14 +275,8 @@ // Utility - Applies to work that takes anywhere from a few seconds to a few minutes to // complete. Examples include downloading a document or importing data. This class // offers a balance between responsiveness, performance, and energy efficiency. - const auto qosClass = [&](){ - switch (Priority) { - case ThreadPriority::Background: return QOS_CLASS_BACKGROUND; - case ThreadPriority::Low: return QOS_CLASS_UTILITY; - case ThreadPriority::Default: return QOS_CLASS_DEFAULT; - } - }(); - return !pthread_set_qos_class_self_np(qosClass, 0) + return !setpriority(PRIO_DARWIN_THREAD, 0, + Priority == ThreadPriority::Default ? 0 : PRIO_DARWIN_BG) ? SetThreadPriorityResult::SUCCESS : SetThreadPriorityResult::FAILURE; #endif