Browse Source

Bugfix: Check list_empty in pop_curl_entry after condition wait

pthread_cond_signal wakes AT LEAST one thread, so it's possible the freed up curl has already been taken
Luke Dashjr 13 years ago
parent
commit
1946c80692
1 changed files with 2 additions and 1 deletions
  1. 2 1
      cgminer.c

+ 2 - 1
cgminer.c

@@ -2175,7 +2175,8 @@ static struct curl_ent *pop_curl_entry(struct pool *pool)
 	mutex_lock(&pool->pool_lock);
 	if (!pool->curls)
 		recruit_curl(pool);
-	else if (list_empty(&pool->curlring)) {
+	else
+	while (list_empty(&pool->curlring)) {
 		if (pool->submit_fail || pool->curls >= curl_limit)
 			pthread_cond_wait(&pool->cr_cond, &pool->pool_lock);
 		else