Commit 67ebf45c1908749d27e2ae60189167a3e1111f0c

Con Kolivas 2013-04-15T11:44:19

Avoid applog under cg_wlock.

diff --git a/cgminer.c b/cgminer.c
index 8470cf9..b0e3c69 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -6598,16 +6598,20 @@ static void *test_pool_thread(void *arg)
 	if (pool_active(pool, false)) {
 		pool_tset(pool, &pool->lagging);
 		pool_tclear(pool, &pool->idle);
+		bool first_pool = false;
 
 		cg_wlock(&control_lock);
 		if (!pools_active) {
 			currentpool = pool;
 			if (pool->pool_no != 0)
-				applog(LOG_NOTICE, "Switching to pool %d %s - first alive pool", pool->pool_no, pool->rpc_url);
+				first_pool = true;
 			pools_active = true;
 		}
 		cg_wunlock(&control_lock);
 
+		if (unlikely(first_pool))
+			applog(LOG_NOTICE, "Switching to pool %d %s - first alive pool", pool->pool_no, pool->rpc_url);
+
 		pool_resus(pool);
 	} else
 		pool_died(pool);