Browse Source

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

ckolivas 13 years ago
parent
commit
145f04ccc7
1 changed files with 4 additions and 1 deletions
  1. 4 1
      cgminer.c

+ 4 - 1
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)