Commit 2ec8bc8c authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

A little bit more work on the expiry/prefetch thing.



git-svn-id: http://www.varnish-cache.org/svn/trunk@232 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 5dc7f0bc
......@@ -16,6 +16,7 @@
static pthread_t exp_thread;
static struct binheap *exp_heap;
static pthread_mutex_t expmtx;
static unsigned expearly = 30;
/*--------------------------------------------------------------------*/
......@@ -40,12 +41,17 @@ exp_main(void *arg)
time(&t);
AZ(pthread_mutex_lock(&expmtx));
o = binheap_root(exp_heap);
AZ(pthread_mutex_unlock(&expmtx));
if (o != NULL) {
printf("Root: %p %d (%d)\n",
(void*)o, o->ttl, o->ttl - t);
if (o == NULL || o->ttl - t > expearly) {
AZ(pthread_mutex_unlock(&expmtx));
if (o != NULL)
printf("Root: %p %d (%d)\n",
(void*)o, o->ttl, o->ttl - t);
sleep(1);
continue;
}
sleep(1);
printf("Root: %p %d (%d)\n", (void*)o, o->ttl, o->ttl - t);
binheap_delete(exp_heap, 0);
AZ(pthread_mutex_unlock(&expmtx));
}
return ("FOOBAR");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment