From 79ffb95f05dd4ff74f805b37957c375c408901e6 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 16 Aug 2017 12:57:05 +0300 Subject: [PATCH] Added support for --cpu-priority for OS X. --- src/Platform_mac.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Platform_mac.cpp b/src/Platform_mac.cpp index 456e6f744..f57c7ea1c 100644 --- a/src/Platform_mac.cpp +++ b/src/Platform_mac.cpp @@ -23,6 +23,7 @@ #include +#include #include @@ -61,6 +62,37 @@ void Platform::setProcessPriority(int priority) void Platform::setThreadPriority(int priority) { + if (priority == -1) { + return; + } + int prio = 19; + switch (priority) + { + case 1: + prio = 5; + break; + + case 2: + prio = 0; + break; + + case 3: + prio = -5; + break; + + case 4: + prio = -10; + break; + + case 5: + prio = -15; + break; + + default: + break; + } + + setpriority(PRIO_PROCESS, 0, prio); }