r3906 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Mon Mar 9 14:52:54 CET 2009
Author: phk
Date: 2009-03-09 14:52:53 +0100 (Mon, 09 Mar 2009)
New Revision: 3906
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_expire.c
trunk/varnish-cache/bin/varnishd/cache_pool.c
Log:
Give WRK_BgThread() a "void *priv" argument also.
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2009-03-09 13:46:22 UTC (rev 3905)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2009-03-09 13:52:53 UTC (rev 3906)
@@ -573,8 +573,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: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c 2009-03-09 13:46:22 UTC (rev 3905)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2009-03-09 13:52:53 UTC (rev 3906)
@@ -209,12 +209,13 @@
*/
static void *
-exp_timer(struct sess *sp)
+exp_timer(struct sess *sp, void *priv)
{
struct objcore *oc;
struct object *o;
double t;
+ (void)priv;
AZ(sleep(10)); /* XXX: Takes time for VCL to arrive */
VCL_Get(&sp->vcl);
t = TIM_real();
@@ -385,5 +386,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: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c 2009-03-09 13:46:22 UTC (rev 3905)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2009-03-09 13:52:53 UTC (rev 3906)
@@ -687,6 +687,7 @@
#define BGTHREAD_MAGIC 0x23b5152b
const char *name;
bgthread_t *func;
+ void *priv;
};
static void *
@@ -710,7 +711,7 @@
ww.wle = logbuf + sizeof logbuf;
ww.stats = &stats;
- (void)bt->func(sp);
+ (void)bt->func(sp, bt->priv);
WRONG("BgThread terminated");
@@ -718,7 +719,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;
@@ -727,6 +728,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