Added support for --cpu-priority for OS X.

This commit is contained in:
XMRig 2017-08-16 12:57:05 +03:00
parent 1b0ddae4eb
commit 79ffb95f05

View file

@ -23,6 +23,7 @@
#include <stdlib.h>
#include <sys/resource.h>
#include <uv.h>
@ -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);
}