Commit c7bcad653b79ee54429aec4964f4aa80e49db1d1

ckolivas 2012-08-07T11:59:54

Need to recheck the pool->curls count on regaining the pool lock after the pthread conditional wait returns.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/cgminer.c b/cgminer.c
index 39e52bd..cc6f949 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2201,12 +2201,14 @@ static struct curl_ent *pop_curl_entry(struct pool *pool)
 	struct curl_ent *ce;
 
 	mutex_lock(&pool->pool_lock);
+retry:
 	if (!pool->curls)
 		recruit_curl(pool);
 	else if (list_empty(&pool->curlring)) {
-		if (pool->submit_fail || pool->curls >= curl_limit)
+		if (pool->submit_fail || pool->curls >= curl_limit) {
 			pthread_cond_wait(&pool->cr_cond, &pool->pool_lock);
-		else
+			goto retry;
+		} else
 			recruit_curl(pool);
 	}
 	ce = list_entry(pool->curlring.next, struct curl_ent, node);