From e076d1104afde76d69dbb49923f2e97de921014d Mon Sep 17 00:00:00 2001 From: phk Date: Thu, 6 Jul 2006 20:26:59 +0000 Subject: [PATCH] The grim reaper needs to wait for objects refcount to drop to zero. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@355 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_expire.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_expire.c b/varnish-cache/bin/varnishd/cache_expire.c index be50b0ee..89c8b1a4 100644 --- a/varnish-cache/bin/varnishd/cache_expire.c +++ b/varnish-cache/bin/varnishd/cache_expire.c @@ -53,8 +53,13 @@ exp_hangman(void *arg) while (1) { time (&t); AZ(pthread_mutex_lock(&exp_mtx)); - o = TAILQ_FIRST(&exp_deathrow); - if (o == NULL || o->ttl >= t) { /* XXX: > or >= ? */ + TAILQ_FOREACH(o, &exp_deathrow, deathrow) { + if (o->ttl >= t) + break; + if (o->refcnt == 0) + break; + } + if (o == NULL || o->ttl >= t || o->refcnt > 0) { AZ(pthread_mutex_unlock(&exp_mtx)); sleep(1); continue; -- 2.39.5