1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

Do not hold the mining thread lock in restart_threads when calling the driver flush work commands.

This commit is contained in:
Con Kolivas 2013-11-16 10:44:41 +11:00 committed by Noel Maersk
parent b5eddd1159
commit e9f20f5e0b

View File

@ -3675,7 +3675,7 @@ static void restart_threads(void)
{ {
struct pool *cp = current_pool(); struct pool *cp = current_pool();
struct cgpu_info *cgpu; struct cgpu_info *cgpu;
int i; int i, mt;
/* Artificially set the lagging flag to avoid pool not providing work /* Artificially set the lagging flag to avoid pool not providing work
* fast enough messages after every long poll */ * fast enough messages after every long poll */
@ -3685,7 +3685,10 @@ static void restart_threads(void)
discard_stale(); discard_stale();
rd_lock(&mining_thr_lock); rd_lock(&mining_thr_lock);
for (i = 0; i < mining_threads; i++) { mt = mining_threads;
rd_unlock(&mining_thr_lock);
for (i = 0; i < mt; i++) {
cgpu = mining_thr[i]->cgpu; cgpu = mining_thr[i]->cgpu;
if (unlikely(!cgpu)) if (unlikely(!cgpu))
continue; continue;
@ -3695,7 +3698,6 @@ static void restart_threads(void)
flush_queue(cgpu); flush_queue(cgpu);
cgpu->drv->flush_work(cgpu); cgpu->drv->flush_work(cgpu);
} }
rd_unlock(&mining_thr_lock);
mutex_lock(&restart_lock); mutex_lock(&restart_lock);
pthread_cond_broadcast(&restart_cond); pthread_cond_broadcast(&restart_cond);