From 145f04ccc749073cc10c079002372f3008a0f935 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Tue, 7 Aug 2012 11:10:59 +1000 Subject: [PATCH] Display reaped debug message outside mutex lock to avoid recursive locking. --- cgminer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cgminer.c b/cgminer.c index d73ecac7..d1cb971a 100644 --- a/cgminer.c +++ b/cgminer.c @@ -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)