Browse Source

Send the shutdown message to threads and do the thread shutdown functions before more forcefully sending pthread_cancel to threads.

nfactor-troky
ckolivas 12 years ago
parent
commit
5b9cf0f077
  1. 22
      cgminer.c

22
cgminer.c

@ -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, "Killing off mining threads"); applog(LOG_DEBUG, "Shutting down mining threads");
/* Kill the mining threads*/
for (i = 0; i < mining_threads; i++) { for (i = 0; i < mining_threads; i++) {
pthread_t *pth = NULL; struct cgpu_info *cgpu;
struct device_drv *drv;
thr = get_thread(i); thr = get_thread(i);
if (thr) { if (!thr)
struct device_drv *drv = thr->cgpu->drv; continue;
cgpu = thr->cgpu;
if (!cgpu)
continue;
drv = cgpu->drv;
if (!drv)
continue;
cgpu->shutdown = true;
drv->thread_shutdown(thr); 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;
if (thr && PTH(thr) != 0L) if (thr && PTH(thr) != 0L)
pth = &thr->pth; pth = &thr->pth;
thr_info_cancel(thr); thr_info_cancel(thr);

Loading…
Cancel
Save