Browse Source

Can use a read lock instead of a write lock in bflsc scanwork.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
6db9745287
  1. 6
      driver-bflsc.c

6
driver-bflsc.c

@ -1532,12 +1532,12 @@ static int64_t bflsc_scanwork(struct thr_info *thr)
cleanup = false; cleanup = false;
// Is there any flushed work that can be removed? // Is there any flushed work that can be removed?
wr_lock(&(sc_info->stat_lock)); rd_lock(&(sc_info->stat_lock));
if (sc_info->sc_devs[dev].flushed) { if (sc_info->sc_devs[dev].flushed) {
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)); rd_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) {
@ -1563,8 +1563,8 @@ static int64_t bflsc_scanwork(struct thr_info *thr)
restart_wait(sc_info->scan_sleep_time); restart_wait(sc_info->scan_sleep_time);
// Count up the work done since we last were here // Count up the work done since we last were here
wr_lock(&(sc_info->stat_lock));
ret = 0; ret = 0;
wr_lock(&(sc_info->stat_lock));
for (dev = 0; dev < sc_info->sc_count; dev++) { for (dev = 0; dev < sc_info->sc_count; dev++) {
unsent = sc_info->sc_devs[dev].hashes_unsent; unsent = sc_info->sc_devs[dev].hashes_unsent;
sc_info->sc_devs[dev].hashes_unsent = 0; sc_info->sc_devs[dev].hashes_unsent = 0;

Loading…
Cancel
Save