From 718ec394030ca2da3973e0135d073e000b366848 Mon Sep 17 00:00:00 2001
Date: Sun, 16 May 2021 12:22:44 -0700
Subject: [PATCH 08/24] Threading: Only call setpriority(PRIO_DARWIN_THREAD, 0,
 PRIO_DARWIN_BG) if it is available

---
 llvm/lib/Support/Unix/Threading.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc
index 8162c60b2cdd..e0564c24b7f2 100644
--- a/llvm/lib/Support/Unix/Threading.inc
+++ b/llvm/lib/Support/Unix/Threading.inc
@@ -259,7 +259,7 @@ SetThreadPriorityResult llvm::set_thread_priority(ThreadPriority Priority) {
              &priority)
              ? SetThreadPriorityResult::SUCCESS
              : SetThreadPriorityResult::FAILURE;
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) && defined(PRIO_DARWIN_THREAD) && defined(PRIO_DARWIN_BG)
   // https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getpriority.2.html
   // When setting a thread into background state the scheduling priority is set
   // to lowest value, disk and network IO are throttled. Network IO will be
-- 
2.21.1 (Apple Git-122.3)

