mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-27 15:04:17 +00:00
Set priority of various threads if possible.
Conflicts: cgminer.c
This commit is contained in:
parent
e9f20f5e0b
commit
39121183e1
29
cgminer.c
29
cgminer.c
@ -4314,6 +4314,30 @@ void zero_stats(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_highprio(void)
|
||||||
|
{
|
||||||
|
#ifndef WIN32
|
||||||
|
int ret = nice(-10);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
applog(LOG_DEBUG, "Unable to set thread to high priority");
|
||||||
|
#else
|
||||||
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_lowprio(void)
|
||||||
|
{
|
||||||
|
#ifndef WIN32
|
||||||
|
int ret = nice(10);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
applog(LOG_INFO, "Unable to set thread to low priority");
|
||||||
|
#else
|
||||||
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_LOWEST);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CURSES
|
#ifdef HAVE_CURSES
|
||||||
static void display_pools(void)
|
static void display_pools(void)
|
||||||
{
|
{
|
||||||
@ -4721,6 +4745,7 @@ static void *api_thread(void *userdata)
|
|||||||
|
|
||||||
RenameThread("api");
|
RenameThread("api");
|
||||||
|
|
||||||
|
set_lowprio();
|
||||||
api(api_thr_id);
|
api(api_thr_id);
|
||||||
|
|
||||||
PTH(mythr) = 0L;
|
PTH(mythr) = 0L;
|
||||||
@ -6383,6 +6408,7 @@ void *miner_thread(void *userdata)
|
|||||||
applog(LOG_DEBUG, "Waiting on sem in miner thread");
|
applog(LOG_DEBUG, "Waiting on sem in miner thread");
|
||||||
cgsem_wait(&mythr->sem);
|
cgsem_wait(&mythr->sem);
|
||||||
|
|
||||||
|
set_highprio();
|
||||||
drv->hash_work(mythr);
|
drv->hash_work(mythr);
|
||||||
out:
|
out:
|
||||||
drv->thread_shutdown(mythr);
|
drv->thread_shutdown(mythr);
|
||||||
@ -6661,6 +6687,8 @@ static void *watchpool_thread(void __maybe_unused *userdata)
|
|||||||
|
|
||||||
RenameThread("watchpool");
|
RenameThread("watchpool");
|
||||||
|
|
||||||
|
set_lowprio();
|
||||||
|
|
||||||
while (42) {
|
while (42) {
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
int i;
|
int i;
|
||||||
@ -6744,6 +6772,7 @@ static void *watchdog_thread(void __maybe_unused *userdata)
|
|||||||
|
|
||||||
RenameThread("watchdog");
|
RenameThread("watchdog");
|
||||||
|
|
||||||
|
set_lowprio();
|
||||||
memset(&zero_tv, 0, sizeof(struct timeval));
|
memset(&zero_tv, 0, sizeof(struct timeval));
|
||||||
cgtime(&rotate_tv);
|
cgtime(&rotate_tv);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user