From: phk Date: Tue, 5 Feb 2008 09:46:30 +0000 (+0000) Subject: We assume that all CLI processing in the child process happens in the X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37ea5532452f1ceaa973b9cde82096783335e14c;p=varnish We assume that all CLI processing in the child process happens in the same thread (the main thread in fact). Add an assert facility to mark the affected functions, just to make sure nobody (else) gets an anciety attack over missing locking. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2428 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index ae047fe2..b58a5d28 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -470,6 +470,8 @@ void CNT_Init(void); /* cache_cli.c [CLI] */ void CLI_Init(void); +extern pthread_t cli_thread; +#define ASSERT_CLI() do {assert(phtread_self() == cli_thread);} while (0) /* cache_expiry.c */ void EXP_Insert(struct object *o); diff --git a/varnish-cache/bin/varnishd/cache_cli.c b/varnish-cache/bin/varnishd/cache_cli.c index 27572685..f678e074 100644 --- a/varnish-cache/bin/varnishd/cache_cli.c +++ b/varnish-cache/bin/varnishd/cache_cli.c @@ -44,6 +44,8 @@ #include "vsb.h" #include "heritage.h" +pthread_t cli_thread; + /*--------------------------------------------------------------------*/ static void @@ -92,6 +94,7 @@ CLI_Init(void) cli = &clis; memset(cli, 0, sizeof *cli); + cli_thread = pthread_self(); cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); XXXAN(cli->sb); lbuf = 4096;