[llvm-branch-commits] [clang-tools-extra-branch] r354983 - Merging r354765:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 27 06:57:46 PST 2019


Author: hans
Date: Wed Feb 27 06:57:46 2019
New Revision: 354983

URL: http://llvm.org/viewvc/llvm-project?rev=354983&view=rev
Log:
Merging r354765:
------------------------------------------------------------------------
r354765 | kadircet | 2019-02-25 10:19:26 +0100 (Mon, 25 Feb 2019) | 9 lines

[clangd] Add thread priority lowering for MacOS as well

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D58492
------------------------------------------------------------------------

Modified:
    clang-tools-extra/branches/release_80/   (props changed)
    clang-tools-extra/branches/release_80/clangd/Threading.cpp

Propchange: clang-tools-extra/branches/release_80/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 27 06:57:46 2019
@@ -1 +1 @@
-/clang-tools-extra/trunk:351463,351466-351468,351531,351686,351738,351788,352040,352231,353327,353422,354505
+/clang-tools-extra/trunk:351463,351466-351468,351531,351686,351738,351788,352040,352231,353327,353422,354505,354765

Modified: clang-tools-extra/branches/release_80/clangd/Threading.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/branches/release_80/clangd/Threading.cpp?rev=354983&r1=354982&r2=354983&view=diff
==============================================================================
--- clang-tools-extra/branches/release_80/clangd/Threading.cpp (original)
+++ clang-tools-extra/branches/release_80/clangd/Threading.cpp Wed Feb 27 06:57:46 2019
@@ -7,6 +7,8 @@
 #include <thread>
 #ifdef __USE_POSIX
 #include <pthread.h>
+#elif defined(__APPLE__)
+#include <sys/resource.h>
 #endif
 
 namespace clang {
@@ -121,6 +123,12 @@ void setCurrentThreadPriority(ThreadPrio
       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
 }
 




More information about the llvm-branch-commits mailing list