mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-10 21:04:37 +00:00
Added support for --cpu-priority for OS X.
This commit is contained in:
parent
1b0ddae4eb
commit
79ffb95f05
1 changed files with 32 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue