1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-02-10 14:04:16 +00:00

Display reaped debug message outside mutex lock to avoid recursive locking.

This commit is contained in:
ckolivas 2012-08-07 11:10:59 +10:00
parent 8897e06575
commit 145f04ccc7

View File

@ -4509,12 +4509,13 @@ static void reap_curl(struct pool *pool)
{
struct curl_ent *ent, *iter;
struct timeval now;
int reaped = 0;
gettimeofday(&now, NULL);
mutex_lock(&pool->pool_lock);
list_for_each_entry_safe(ent, iter, &pool->curlring, node) {
if (now.tv_sec - ent->tv.tv_sec > 60) {
applog(LOG_DEBUG, "Reaped curl %d from pool %d", pool->curls, pool->pool_no);
reaped++;
pool->curls--;
list_del(&ent->node);
curl_easy_cleanup(ent->curl);
@ -4522,6 +4523,8 @@ static void reap_curl(struct pool *pool)
}
}
mutex_unlock(&pool->pool_lock);
if (reaped)
applog(LOG_DEBUG, "Reaped %d curl%s from pool %d", reaped, reaped > 1 ? "s" : "", pool->pool_no);
}
static void *watchpool_thread(void __maybe_unused *userdata)