1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-22 04:24:19 +00:00

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

This commit is contained in:
Jan Berdajs 2014-07-07 04:20:41 +02:00
parent 363f52df47
commit e33590f37d

View File

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