mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-10 22:14:18 +00:00
Display reaped debug message outside mutex lock to avoid recursive locking.
This commit is contained in:
parent
8897e06575
commit
145f04ccc7
@ -4509,12 +4509,13 @@ static void reap_curl(struct pool *pool)
|
|||||||
{
|
{
|
||||||
struct curl_ent *ent, *iter;
|
struct curl_ent *ent, *iter;
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
|
int reaped = 0;
|
||||||
|
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
mutex_lock(&pool->pool_lock);
|
mutex_lock(&pool->pool_lock);
|
||||||
list_for_each_entry_safe(ent, iter, &pool->curlring, node) {
|
list_for_each_entry_safe(ent, iter, &pool->curlring, node) {
|
||||||
if (now.tv_sec - ent->tv.tv_sec > 60) {
|
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--;
|
pool->curls--;
|
||||||
list_del(&ent->node);
|
list_del(&ent->node);
|
||||||
curl_easy_cleanup(ent->curl);
|
curl_easy_cleanup(ent->curl);
|
||||||
@ -4522,6 +4523,8 @@ static void reap_curl(struct pool *pool)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&pool->pool_lock);
|
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)
|
static void *watchpool_thread(void __maybe_unused *userdata)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user