Commit 10b9970a05875a57d98f84b452676aecd8ed69a8

Con Kolivas 2014-07-17T15:17:35

Detach test pool thread only if we have a blocking startup

diff --git a/cgminer.c b/cgminer.c
index c44892d..0ada951 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -8658,7 +8658,8 @@ static void *test_pool_thread(void *arg)
 {
 	struct pool *pool = (struct pool *)arg;
 
-	pthread_detach(pthread_self());
+	if (!pool->blocking)
+		pthread_detach(pthread_self());
 retry:
 	if (pool_active(pool, false)) {
 		pool_tset(pool, &pool->lagging);
@@ -8710,12 +8711,12 @@ bool add_pool_details(struct pool *pool, bool live, char *url, char *user, char 
 
 	pool->testing = true;
 	pool->idle = true;
+	pool->blocking = !live;
 	enable_pool(pool);
 
 	pthread_create(&pool->test_thread, NULL, test_pool_thread, (void *)pool);
 	if (!live) {
 		pthread_join(pool->test_thread, NULL);
-		pool->testing = false;
 		return pools_active;
 	}
 	return true;
diff --git a/miner.h b/miner.h
index c649648..7a43fed 100644
--- a/miner.h
+++ b/miner.h
@@ -1201,6 +1201,7 @@ struct pool {
 	bool submit_old;
 	bool removed;
 	bool lp_started;
+	bool blocking;
 
 	char *hdr_path;
 	char *lp_url;