1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-14 16:58:05 +00:00

Check if mining threads are initialized before restarting them.

This commit is contained in:
troky 2014-07-19 17:44:43 +02:00
parent 5bd2689069
commit 82b5320f36

View File

@ -4082,17 +4082,19 @@ static void *restart_thread(void __maybe_unused *arg)
/* Discard staged work that is now stale */ /* Discard staged work that is now stale */
discard_stale(); discard_stale();
rd_lock(&mining_thr_lock); if (mining_thr) {
for (i = 0; i < mining_threads; i++) { rd_lock(&mining_thr_lock);
cgpu = mining_thr[i]->cgpu; for (i = 0; i < mining_threads; i++) {
if (unlikely(!cgpu)) cgpu = mining_thr[i]->cgpu;
continue; if (unlikely(!cgpu))
if (cgpu->deven != DEV_ENABLED) continue;
continue; if (cgpu->deven != DEV_ENABLED)
mining_thr[i]->work_restart = true; continue;
cgpu->drv->flush_work(cgpu); mining_thr[i]->work_restart = true;
cgpu->drv->flush_work(cgpu);
}
rd_unlock(&mining_thr_lock);
} }
rd_unlock(&mining_thr_lock);
mutex_lock(&restart_lock); mutex_lock(&restart_lock);
pthread_cond_broadcast(&restart_cond); pthread_cond_broadcast(&restart_cond);