1
0
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:
ckolivas 2013-05-29 12:06:06 +10:00
parent 173119d59b
commit 5b9cf0f077

View File

@ -2809,18 +2809,30 @@ static void __kill_work(void)
thr = &control_thr[watchdog_thr_id]; thr = &control_thr[watchdog_thr_id];
thr_info_cancel(thr); 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"); applog(LOG_DEBUG, "Killing off mining threads");
/* Kill the mining threads*/ /* Kill the mining threads*/
for (i = 0; i < mining_threads; i++) { for (i = 0; i < mining_threads; i++) {
pthread_t *pth = NULL; 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) if (thr && PTH(thr) != 0L)
pth = &thr->pth; pth = &thr->pth;
thr_info_cancel(thr); thr_info_cancel(thr);