mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 10:01:06 +00:00
#1363 Fixed main thread priority.
This commit is contained in:
parent
c3fd5835c3
commit
05421057ae
7 changed files with 5 additions and 54 deletions
|
@ -90,8 +90,6 @@ int xmrig::App::exec()
|
|||
|
||||
m_controller->start();
|
||||
|
||||
Platform::setThreadPriority(5);
|
||||
|
||||
rc = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
uv_loop_close(uv_default_loop());
|
||||
|
||||
|
|
|
@ -176,10 +176,6 @@ int xmrig::Base::init()
|
|||
|
||||
Platform::init(config()->userAgent());
|
||||
|
||||
# ifndef XMRIG_PROXY_PROJECT
|
||||
Platform::setProcessPriority(config()->cpu().priority());
|
||||
# endif
|
||||
|
||||
if (isBackground()) {
|
||||
Log::background = true;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ public:
|
|||
static uint32_t setTimerResolution(uint32_t resolution);
|
||||
static void init(const char *userAgent);
|
||||
static void restoreTimerResolution();
|
||||
static void setProcessPriority(int priority);
|
||||
static void setThreadPriority(int priority);
|
||||
|
||||
static inline const char *userAgent() { return m_userAgent; }
|
||||
|
|
|
@ -83,11 +83,6 @@ void xmrig::Platform::restoreTimerResolution()
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setProcessPriority(int priority)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setThreadPriority(int priority)
|
||||
{
|
||||
if (priority == -1) {
|
||||
|
|
|
@ -111,11 +111,6 @@ void xmrig::Platform::restoreTimerResolution()
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setProcessPriority(int priority)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setThreadPriority(int priority)
|
||||
{
|
||||
if (priority == -1) {
|
||||
|
|
|
@ -131,43 +131,6 @@ void xmrig::Platform::restoreTimerResolution()
|
|||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setProcessPriority(int priority)
|
||||
{
|
||||
if (priority == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD prio = IDLE_PRIORITY_CLASS;
|
||||
switch (priority)
|
||||
{
|
||||
case 1:
|
||||
prio = BELOW_NORMAL_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
prio = 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;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SetPriorityClass(GetCurrentProcess(), prio);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Platform::setThreadPriority(int priority)
|
||||
{
|
||||
if (priority == -1) {
|
||||
|
|
|
@ -263,6 +263,11 @@ public:
|
|||
xmrig::Miner::Miner(Controller *controller)
|
||||
: d_ptr(new MinerPrivate(controller))
|
||||
{
|
||||
const int priority = controller->config()->cpu().priority();
|
||||
if (priority >= 0) {
|
||||
Platform::setThreadPriority(std::min(priority + 1, 5));
|
||||
}
|
||||
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
Rx::init(this);
|
||||
# endif
|
||||
|
|
Loading…
Reference in a new issue