From 22a7b4050f5828126910f4fab9a55aa0c6a25da8 Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 14 Jun 2006 08:53:21 +0000 Subject: [PATCH] Initialize the cache_acceptor.c/VCA in the same manner as other parts. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@181 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 2 +- varnish-cache/bin/varnishd/cache_acceptor.c | 14 +++++++++++++- varnish-cache/bin/varnishd/cache_main.c | 3 +-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 459a607e..4ce785b1 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -60,9 +60,9 @@ extern struct stevedore *stevedore; /* cache_acceptor.c */ void vca_write(struct sess *sp, void *ptr, size_t len); void vca_flush(struct sess *sp); -void *vca_main(void *arg); void vca_retire_session(struct sess *sp); void vca_recycle_session(struct sess *sp); +void VCA_Init(void); /* cache_backend.c */ void VBE_Init(void); diff --git a/varnish-cache/bin/varnishd/cache_acceptor.c b/varnish-cache/bin/varnishd/cache_acceptor.c index 4e276b76..8eff0542 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor.c +++ b/varnish-cache/bin/varnishd/cache_acceptor.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -33,6 +34,8 @@ static struct event_base *evb; static struct event pipe_e; static int pipes[2]; +static pthread_t vca_thread; + #define SESS_IOVS 5 static struct event accept_e[2 * HERITAGE_NSOCKS]; @@ -137,7 +140,7 @@ accept_f(int fd, short event, void *arg) http_RecvHead(sp->http, sp->fd, evb, DealWithSession, sp); } -void * +static void * vca_main(void *arg) { unsigned u; @@ -194,3 +197,12 @@ vca_retire_session(struct sess *sp) } free(sp); } + +/*--------------------------------------------------------------------*/ + +void +VCA_Init(void) +{ + + AZ(pthread_create(&vca_thread, NULL, vca_main, NULL)); +} diff --git a/varnish-cache/bin/varnishd/cache_main.c b/varnish-cache/bin/varnishd/cache_main.c index 50023b07..c20e7993 100644 --- a/varnish-cache/bin/varnishd/cache_main.c +++ b/varnish-cache/bin/varnishd/cache_main.c @@ -24,7 +24,6 @@ #include "cli_event.h" static struct event ev_keepalive; -static pthread_t vca_thread; struct hash_slinger *hash; struct stevedore *stevedore; @@ -116,7 +115,7 @@ child_main(void) VSL_Init(); CacheInitPool(); - AZ(pthread_create(&vca_thread, NULL, vca_main, NULL)); + VCA_Init(); eb = event_init(); assert(eb != NULL); -- 2.39.5