mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Remove flushed work in bfl scanwork from the hash table.
This commit is contained in:
parent
11baa32792
commit
f1624e13a9
@ -1511,7 +1511,7 @@ static int64_t bflsc_scanwork(struct thr_info *thr)
|
|||||||
struct bflsc_info *sc_info = (struct bflsc_info *)(bflsc->device_file);
|
struct bflsc_info *sc_info = (struct bflsc_info *)(bflsc->device_file);
|
||||||
int64_t ret, unsent;
|
int64_t ret, unsent;
|
||||||
bool flushed, cleanup;
|
bool flushed, cleanup;
|
||||||
struct work *work, *tmp, *flush;
|
struct work *work, *tmp;
|
||||||
int dev;
|
int dev;
|
||||||
|
|
||||||
// Device is gone
|
// Device is gone
|
||||||
@ -1537,29 +1537,26 @@ static int64_t bflsc_scanwork(struct thr_info *thr)
|
|||||||
if (sc_info->sc_devs[dev].result_id > (sc_info->sc_devs[dev].flush_id + 1))
|
if (sc_info->sc_devs[dev].result_id > (sc_info->sc_devs[dev].flush_id + 1))
|
||||||
cleanup = true;
|
cleanup = true;
|
||||||
}
|
}
|
||||||
|
wr_unlock(&(sc_info->stat_lock));
|
||||||
|
|
||||||
// yes remove the flushed work that can be removed
|
// yes remove the flushed work that can be removed
|
||||||
if (cleanup) {
|
if (cleanup) {
|
||||||
// one lock per item - TODO: need a better way to do this?
|
wr_lock(&bflsc->qlock);
|
||||||
do {
|
|
||||||
flush = NULL;
|
|
||||||
rd_lock(&bflsc->qlock);
|
|
||||||
|
|
||||||
HASH_ITER(hh, bflsc->queued_work, work, tmp) {
|
HASH_ITER(hh, bflsc->queued_work, work, tmp) {
|
||||||
if (work->devflag && work->subid == dev)
|
if (work->devflag && work->subid == dev) {
|
||||||
flush = work;
|
bflsc->queued_count--;
|
||||||
|
HASH_DEL(bflsc->queued_work, work);
|
||||||
|
discard_work(work);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
wr_unlock(&bflsc->qlock);
|
||||||
|
|
||||||
rd_unlock(&bflsc->qlock);
|
wr_lock(&(sc_info->stat_lock));
|
||||||
|
|
||||||
if (flush)
|
|
||||||
discard_work(flush);
|
|
||||||
} while (flush);
|
|
||||||
|
|
||||||
sc_info->sc_devs[dev].flushed = false;
|
sc_info->sc_devs[dev].flushed = false;
|
||||||
}
|
|
||||||
wr_unlock(&(sc_info->stat_lock));
|
wr_unlock(&(sc_info->stat_lock));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// avoid a hard loop
|
// avoid a hard loop
|
||||||
if (sc_info->scan_sleep_time > 0)
|
if (sc_info->scan_sleep_time > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user