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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/cgminer.c b/cgminer.c
index f60283b..9c52b22 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -5865,6 +5865,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;
@@ -6023,7 +6026,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;
@@ -8361,8 +8363,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();