]> err.no Git - varnish/commitdiff
We assume that all CLI processing in the child process happens in the
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 5 Feb 2008 09:46:30 +0000 (09:46 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 5 Feb 2008 09:46:30 +0000 (09:46 +0000)
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

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_cli.c

index ae047fe25c285f33422860208086becd0f00d32e..b58a5d28abca3ae6a03c39e95d4336b5303135a6 100644 (file)
@@ -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);
index 2757268502433579cf44c0340ac4550892a97720..f678e074d61c3348ea4e5e099f0467270a6c2b49 100644 (file)
@@ -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;