[PATCH] D58683: [clangd] Set thread priority on Windows
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 26 09:27:37 PST 2019
ilya-biryukov created this revision.
ilya-biryukov added reviewers: kadircet, gribozavr.
Herald added subscribers: arphaman, jkorous, MaskRay, ioeric.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D58683
Files:
clang-tools-extra/clangd/Threading.cpp
Index: clang-tools-extra/clangd/Threading.cpp
===================================================================
--- clang-tools-extra/clangd/Threading.cpp
+++ clang-tools-extra/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.188396.patch
Type: text/x-patch
Size: 789 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190226/2e22fae4/attachment.bin>
More information about the cfe-commits
mailing list