From: phk Date: Mon, 11 Sep 2006 17:18:31 +0000 (+0000) Subject: If we have more threads than the max, kill one if we can. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=701966ed75cb14881b3d59d84d43a1d857582d4f;p=varnish If we have more threads than the max, kill one if we can. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@968 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_pool.c b/varnish-cache/bin/varnishd/cache_pool.c index 6d9a58ac..fcec8481 100644 --- a/varnish-cache/bin/varnishd/cache_pool.c +++ b/varnish-cache/bin/varnishd/cache_pool.c @@ -269,7 +269,9 @@ wrk_reaperthread(void *priv) now = time(NULL); LOCK(&wrk_mtx); w = TAILQ_LAST(&wrk_idle, workerhead); - if (w != NULL && w->idle + params->wthread_timeout < now) + if (w != NULL && + (w->idle + params->wthread_timeout < now || + VSL_stats->n_wrk <= params->wthread_max) TAILQ_REMOVE(&wrk_idle, w, list); else w = NULL;