Commit f80d19bb61c01deb2ceed71f35b0bba8949a6b35

Con Kolivas 2014-02-28T00:37:55

Increase the work queue at the top end if we've hit the bottom as well.

diff --git a/cgminer.c b/cgminer.c
index 4fd9106..0d2b239 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -6281,6 +6281,7 @@ static void pool_resus(struct pool *pool)
 }
 
 static bool work_filled;
+static bool work_emptied;
 
 /* If this is called non_blocking, it will return NULL for work so that must
  * be handled. */
@@ -6297,6 +6298,7 @@ static struct work *hash_pop(bool blocking)
 			opt_queue++;
 			work_filled = false;
 		}
+		work_emptied = true;
 		if (!blocking)
 			goto out_unlock;
 		do {
@@ -8971,6 +8973,10 @@ begin_bench:
 
 		/* Wait until hash_pop tells us we need to create more work */
 		if (ts > max_staged) {
+			if (work_emptied) {
+				opt_queue++;
+				work_emptied = false;
+			}
 			work_filled = true;
 			pthread_cond_wait(&gws_cond, stgd_lock);
 			ts = __total_staged();
@@ -8981,6 +8987,10 @@ 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. */
+			if (work_emptied) {
+				opt_queue++;
+				work_emptied = false;
+			}
 			work_filled = true;
 			work = hash_pop(false);
 			if (work)