Browse Source

Protect enabled_pools by a mutex in disable_pool function

Huang Le 11 years ago
parent
commit
3bd3f9b913
1 changed files with 4 additions and 0 deletions
  1. 4 0
      miner.c

+ 4 - 0
miner.c

@@ -4419,8 +4419,12 @@ void disable_pool(struct pool * const pool, const enum pool_enable enable_status
 		return;
 		return;
 	}
 	}
 	
 	
+	/* Fall into the lock area */
+	mutex_lock(&lp_lock);
 	--enabled_pools;
 	--enabled_pools;
 	pool->enabled = enable_status;
 	pool->enabled = enable_status;
+	mutex_unlock(&lp_lock);
+	
 	if (pool == current_pool())
 	if (pool == current_pool())
 		switch_pools(NULL);
 		switch_pools(NULL);
 }
 }