]> err.no Git - varnish/commitdiff
The grim reaper needs to wait for objects refcount to drop to zero.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 6 Jul 2006 20:26:59 +0000 (20:26 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 6 Jul 2006 20:26:59 +0000 (20:26 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@355 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_expire.c

index be50b0ee0c759d9380626e5af6e4326001e29f7a..89c8b1a49c3dcb6f15e3ddff7eed344536c195ab 100644 (file)
@@ -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;