mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-23 13:04:29 +00:00
Send the shutdown message to threads and do the thread shutdown functions before more forcefully sending pthread_cancel to threads.
This commit is contained in:
parent
173119d59b
commit
5b9cf0f077
26
cgminer.c
26
cgminer.c
@ -2809,18 +2809,30 @@ static void __kill_work(void)
|
||||
thr = &control_thr[watchdog_thr_id];
|
||||
thr_info_cancel(thr);
|
||||
|
||||
applog(LOG_DEBUG, "Shutting down mining threads");
|
||||
for (i = 0; i < mining_threads; i++) {
|
||||
struct cgpu_info *cgpu;
|
||||
struct device_drv *drv;
|
||||
|
||||
thr = get_thread(i);
|
||||
if (!thr)
|
||||
continue;
|
||||
cgpu = thr->cgpu;
|
||||
if (!cgpu)
|
||||
continue;
|
||||
drv = cgpu->drv;
|
||||
if (!drv)
|
||||
continue;
|
||||
|
||||
cgpu->shutdown = true;
|
||||
drv->thread_shutdown(thr);
|
||||
}
|
||||
|
||||
applog(LOG_DEBUG, "Killing off mining threads");
|
||||
/* Kill the mining threads*/
|
||||
for (i = 0; i < mining_threads; i++) {
|
||||
pthread_t *pth = NULL;
|
||||
|
||||
thr = get_thread(i);
|
||||
if (thr) {
|
||||
struct device_drv *drv = thr->cgpu->drv;
|
||||
|
||||
drv->thread_shutdown(thr);
|
||||
}
|
||||
|
||||
if (thr && PTH(thr) != 0L)
|
||||
pth = &thr->pth;
|
||||
thr_info_cancel(thr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user