Don't start testing any pools with the watchpool thread if any of the test threads are still active.
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 41 42 43 44
diff --git a/cgminer.c b/cgminer.c
index c990911..10613b5 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -6135,6 +6135,13 @@ static void *watchpool_thread(void __maybe_unused *userdata)
if (pool->enabled == POOL_DISABLED)
continue;
+ /* Don't start testing any pools if the test threads
+ * from startup are still doing their first attempt. */
+ if (unlikely(pool->testing)) {
+ pthread_join(pool->test_thread, NULL);
+ pool->testing = false;
+ }
+
/* Test pool is idle once every minute */
if (pool->idle && now.tv_sec - pool->tv_idle.tv_sec > 30) {
gettimeofday(&pool->tv_idle, NULL);
@@ -6991,10 +6998,10 @@ static void probe_pools(void)
int i;
for (i = 0; i < total_pools; i++) {
- pthread_t *test_thread = malloc(sizeof(pthread_t));
struct pool *pool = pools[i];
- pthread_create(test_thread, NULL, test_pool_thread, (void *)pool);
+ pool->testing = true;
+ pthread_create(&pool->test_thread, NULL, test_pool_thread, (void *)pool);
}
}
diff --git a/miner.h b/miner.h
index eee30f1..a44b9c1 100644
--- a/miner.h
+++ b/miner.h
@@ -968,6 +968,8 @@ struct pool {
struct thread_q *getwork_q;
pthread_t longpoll_thread;
+ pthread_t test_thread;
+ bool testing;
int curls;
pthread_cond_t cr_cond;