From 5315838d2d7ab103164ea12ca1c1210a422ff179 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Fri, 19 Apr 2013 09:19:05 +1000 Subject: [PATCH] Restart threads on the rare chance we found the block ourselves. --- cgminer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cgminer.c b/cgminer.c index 2833e8aa..046f4a25 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++;