Browse Source

Thread was never joined because thr_info_cancel sets pth to 0. Should improve mining thread hard reset.

djm34
Jan Berdajs 11 years ago
parent
commit
e33590f37d
  1. 5
      sgminer.c

5
sgminer.c

@ -3322,11 +3322,11 @@ static void kill_mining(void) @@ -3322,11 +3322,11 @@ static void kill_mining(void)
/* Kill the mining threads*/
rd_lock(&mining_thr_lock);
for (i = 0; i < mining_threads; i++) {
pthread_t *pth = NULL;
pthread_t *pth = (pthread_t *) calloc(1, sizeof(pthread_t));
thr = mining_thr[i];
if (thr && PTH(thr) != 0L)
pth = &thr->pth;
*pth = thr->pth;
thr_info_cancel(thr);
forcelog(LOG_DEBUG, "Waiting for thread %d to finish...", thr->id);
#ifndef WIN32
@ -3336,6 +3336,7 @@ static void kill_mining(void) @@ -3336,6 +3336,7 @@ static void kill_mining(void)
if (pth && pth->p)
pthread_join(*pth, NULL);
#endif
free(pth);
}
rd_unlock(&mining_thr_lock);
}

Loading…
Cancel
Save