r4258 - branches/2.0/varnish-cache/bin/varnishd

tfheen at projects.linpro.no tfheen at projects.linpro.no
Mon Sep 28 16:05:51 CEST 2009


Author: tfheen
Date: 2009-09-28 16:05:51 +0200 (Mon, 28 Sep 2009)
New Revision: 4258

Modified:
   branches/2.0/varnish-cache/bin/varnishd/cache.h
   branches/2.0/varnish-cache/bin/varnishd/cache_expire.c
   branches/2.0/varnish-cache/bin/varnishd/cache_pool.c
Log:
Merge r3906: Give WRK_BgThread() a "void *priv" argument also.



Modified: branches/2.0/varnish-cache/bin/varnishd/cache.h
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-09-28 14:00:23 UTC (rev 4257)
+++ branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-09-28 14:05:51 UTC (rev 4258)
@@ -543,8 +543,8 @@
 void WRW_Sendfile(struct worker *w, int fd, off_t off, unsigned len);
 #endif  /* SENDFILE_WORKS */
 
-typedef void *bgthread_t(struct sess *);
-void WRK_BgThread(pthread_t *thr, const char *name, bgthread_t *func);
+typedef void *bgthread_t(struct sess *, void *priv);
+void WRK_BgThread(pthread_t *thr, const char *name, bgthread_t *func, void *priv);
 
 /* cache_session.c [SES] */
 void SES_Init(void);

Modified: branches/2.0/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_expire.c	2009-09-28 14:00:23 UTC (rev 4257)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_expire.c	2009-09-28 14:05:51 UTC (rev 4258)
@@ -275,12 +275,13 @@
  */
 
 static void *
-exp_timer(struct sess *sp)
+exp_timer(struct sess *sp, void *priv)
 {
 	struct objexp *oe;
 	struct object *o;
 	double t;
 
+	(void)priv;
 	AZ(sleep(10));		/* XXX: Takes time for VCL to arrive */
 	VCL_Get(&sp->vcl);
 	t = TIM_real();
@@ -468,5 +469,5 @@
 	Lck_New(&exp_mtx);
 	exp_heap = binheap_new(NULL, object_cmp, object_update);
 	XXXAN(exp_heap);
-	WRK_BgThread(&exp_thread, "cache-timeout", exp_timer);
+	WRK_BgThread(&exp_thread, "cache-timeout", exp_timer, NULL);
 }

Modified: branches/2.0/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_pool.c	2009-09-28 14:00:23 UTC (rev 4257)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_pool.c	2009-09-28 14:05:51 UTC (rev 4258)
@@ -628,6 +628,7 @@
 #define BGTHREAD_MAGIC	0x23b5152b
 	const char	*name;
 	bgthread_t	*func;
+	void		*priv;
 };
 
 static void *
@@ -648,7 +649,7 @@
 	ww.wlp = ww.wlb = logbuf;
 	ww.wle = logbuf + sizeof logbuf;
 
-	(void)bt->func(sp);
+	(void)bt->func(sp, bt->priv);
 
 	WRONG("BgThread terminated");
 
@@ -656,7 +657,7 @@
 }
 
 void
-WRK_BgThread(pthread_t *thr, const char *name, bgthread_t *func)
+WRK_BgThread(pthread_t *thr, const char *name, bgthread_t *func, void *priv)
 {
 	struct bgthread *bt;
 
@@ -665,6 +666,7 @@
 
 	bt->name = name;
 	bt->func = func;
+	bt->priv = priv;
 	AZ(pthread_create(thr, NULL, wrk_bgthread, bt));
 }
 



More information about the varnish-commit mailing list