[PATCH] D58683: [clangd] Set thread priority on Windows

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 27 02:15:58 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE354957: [clangd] Set thread priority on Windows (authored by ibiryukov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D58683?vs=188396&id=188505#toc

Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58683/new/

https://reviews.llvm.org/D58683

Files:
  clangd/Threading.cpp


Index: clangd/Threading.cpp
===================================================================
--- clangd/Threading.cpp
+++ clangd/Threading.cpp
@@ -9,6 +9,8 @@
 #include <pthread.h>
 #elif defined(__APPLE__)
 #include <sys/resource.h>
+#elif defined (_WIN32)
+#include <Windows.h>
 #endif
 
 namespace clang {
@@ -129,6 +131,11 @@
               Priority == ThreadPriority::Low && !AvoidThreadStarvation
                   ? PRIO_DARWIN_BG
                   : 0);
+#elif defined(_WIN32)
+  SetThreadPriority(GetCurrentThread(),
+                    Priority == ThreadPriority::Low && !AvoidThreadStarvation
+                        ? THREAD_MODE_BACKGROUND_BEGIN
+                        : THREAD_MODE_BACKGROUND_END);
 #endif
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58683.188505.patch
Type: text/x-patch
Size: 735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190227/8da864d8/attachment.bin>


More information about the cfe-commits mailing list