Increase the opt_queue if we can hit the maximum amount asked for but are still bottoming out.
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 39 40 41 42
diff --git a/cgminer.c b/cgminer.c
index 11928aa..742871a 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -6280,6 +6280,8 @@ static void pool_resus(struct pool *pool)
applog(LOG_INFO, "Pool %d %s alive", pool->pool_no, pool->rpc_url);
}
+static bool work_filled;
+
/* If this is called non_blocking, it will return NULL for work so that must
* be handled. */
static struct work *hash_pop(bool blocking)
@@ -6289,6 +6291,12 @@ static struct work *hash_pop(bool blocking)
mutex_lock(stgd_lock);
if (!HASH_COUNT(staged_work)) {
+ /* Increase the queue if we reach zero and we know we can reach
+ * the maximum we're asking for. */
+ if (work_filled) {
+ opt_queue++;
+ work_filled = false;
+ }
if (!blocking)
goto out_unlock;
do {
@@ -8962,6 +8970,7 @@ begin_bench:
/* Wait until hash_pop tells us we need to create more work */
if (ts > max_staged) {
+ work_filled = true;
pthread_cond_wait(&gws_cond, stgd_lock);
ts = __total_staged();
}
@@ -8971,6 +8980,7 @@ begin_bench:
/* 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_filled = true;
work = hash_pop(false);
if (work)
discard_work(work);