Browse Source

Bugfix: switch_pools: Broadcast lp_cond outside of control_lock to avoid deadlocking

Luke Dashjr 11 years ago
parent
commit
b3e7e09efc
1 changed files with 1 additions and 1 deletions
  1. 1 1
      miner.c

+ 1 - 1
miner.c

@@ -6419,10 +6419,10 @@ void switch_pools(struct pool *selected)
 	if (pool_unusable(pool) && failover_pool)
 	if (pool_unusable(pool) && failover_pool)
 		pool = failover_pool;
 		pool = failover_pool;
 	currentpool = pool;
 	currentpool = pool;
+	cg_wunlock(&control_lock);
 	mutex_lock(&lp_lock);
 	mutex_lock(&lp_lock);
 	pthread_cond_broadcast(&lp_cond);
 	pthread_cond_broadcast(&lp_cond);
 	mutex_unlock(&lp_lock);
 	mutex_unlock(&lp_lock);
-	cg_wunlock(&control_lock);
 
 
 	/* Set the lagging flag to avoid pool not providing work fast enough
 	/* Set the lagging flag to avoid pool not providing work fast enough
 	 * messages in failover only mode since  we have to get all fresh work
 	 * messages in failover only mode since  we have to get all fresh work