Detach test pool thread only if we have a blocking startup
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
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;