Commit 5315838d2d7ab103164ea12ca1c1210a422ff179

ckolivas 2013-04-19T09:19:05

Restart threads on the rare chance we found the block ourselves.

diff --git a/cgminer.c b/cgminer.c
index 2833e8a..046f4a2 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2298,6 +2298,8 @@ static void reject_pool(struct pool *pool)
 	pool->enabled = POOL_REJECTING;
 }
 
+static void restart_threads(void);
+
 /* Theoretically threads could race when modifying accepted and
  * rejected values but the chance of two submits completing at the
  * same time is zero so there is no point adding extra locking */
@@ -2351,6 +2353,10 @@ share_result(json_t *val, json_t *res, json_t *err, const struct work *work,
 			enable_pool(pool);
 			switch_pools(NULL);
 		}
+		/* If we know we found the block we know better than anyone
+		 * that new work is needed. */
+		if (unlikely(work->block))
+			restart_threads();
 	} else {
 		mutex_lock(&stats_lock);
 		cgpu->rejected++;