mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-14 08:48:01 +00:00
Check if mining threads are initialized before restarting them.
This commit is contained in:
parent
5bd2689069
commit
82b5320f36
22
sgminer.c
22
sgminer.c
@ -4082,17 +4082,19 @@ static void *restart_thread(void __maybe_unused *arg)
|
||||
/* Discard staged work that is now stale */
|
||||
discard_stale();
|
||||
|
||||
rd_lock(&mining_thr_lock);
|
||||
for (i = 0; i < mining_threads; i++) {
|
||||
cgpu = mining_thr[i]->cgpu;
|
||||
if (unlikely(!cgpu))
|
||||
continue;
|
||||
if (cgpu->deven != DEV_ENABLED)
|
||||
continue;
|
||||
mining_thr[i]->work_restart = true;
|
||||
cgpu->drv->flush_work(cgpu);
|
||||
if (mining_thr) {
|
||||
rd_lock(&mining_thr_lock);
|
||||
for (i = 0; i < mining_threads; i++) {
|
||||
cgpu = mining_thr[i]->cgpu;
|
||||
if (unlikely(!cgpu))
|
||||
continue;
|
||||
if (cgpu->deven != DEV_ENABLED)
|
||||
continue;
|
||||
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);
|
||||
pthread_cond_broadcast(&restart_cond);
|
||||
|
Loading…
Reference in New Issue
Block a user