From 117c032b92cdcd321350ff91c1693fc37b3ce3c5 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 7 Feb 2014 01:00:35 +1100 Subject: [PATCH] Slowly remove work even if it's not being used to keep the getwork counter incrementing even if work is not used and as a test that pools are still working. --- sgminer.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sgminer.c b/sgminer.c index 5d4dc9de..abb82e59 100644 --- a/sgminer.c +++ b/sgminer.c @@ -5761,6 +5761,9 @@ static struct work *hash_pop(void) /* Signal hash_pop again in case there are mutliple hash_pop waiters */ pthread_cond_signal(&getq->cond); + + /* Keep track of last getwork grabbed */ + last_getwork = time(NULL); mutex_unlock(stgd_lock); return work; @@ -5920,7 +5923,6 @@ struct work *get_work(struct thr_info *thr, const int thr_id) wake_gws(); } } - last_getwork = time(NULL); applog(LOG_DEBUG, "Got work from get queue to get work for thread %d", thr_id); work->thr_id = thr_id; @@ -8155,8 +8157,14 @@ begin_bench: } mutex_unlock(stgd_lock); - if (ts > max_staged) + if (ts > max_staged) { + /* Keeps slowly generating work even if it's not being + * used to keep last_getwork incrementing and to see + * if pools are still alive. */ + work = hash_pop(); + discard_work(work); continue; + } work = make_work();