From 65cefa4a7d052fb5628a39f36fecbd49cc3656cc Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Thu, 22 Jan 2015 03:08:41 +0100 Subject: [PATCH] cpu-priority: fix for windows process --- ccminer.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ccminer.cpp b/ccminer.cpp index 67a4e5d..661d4e3 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -2276,6 +2276,24 @@ int main(int argc, char *argv[]) signal(SIGINT, signal_handler); #else SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleHandler, TRUE); + if (opt_priority > 0) { + DWORD prio = NORMAL_PRIORITY_CLASS; + SetPriorityClass(NULL, prio); + switch (opt_priority) { + case 1: + prio = BELOW_NORMAL_PRIORITY_CLASS; + break; + case 3: + prio = ABOVE_NORMAL_PRIORITY_CLASS; + break; + case 4: + prio = HIGH_PRIORITY_CLASS; + break; + case 5: + prio = REALTIME_PRIORITY_CLASS; + } + SetPriorityClass(GetCurrentProcess(), prio); + } #endif if (active_gpus == 0) {