Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58492
llvm-svn: 354765
#include <thread>
#ifdef __USE_POSIX
#include <pthread.h>
+#elif defined(__APPLE__)
+#include <sys/resource.h>
#endif
namespace clang {
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
}