Commit e61cc7b7b0099176e32141e1706411ac8416e5ee

Con Kolivas 2014-02-28T00:11:52

Increase the opt_queue if we can hit the maximum amount asked for but are still bottoming out.

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);