pthread_cond_signal wakes AT LEAST one thread, so it's possible the freed up curl has already been taken
@@ -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