From: phk Date: Wed, 6 Sep 2006 20:45:49 +0000 (+0000) Subject: Give the stats summation its own mutex X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86f637fab176a21f6160af3ba569bc18e809fd14;p=varnish Give the stats summation its own mutex git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@930 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_session.c b/varnish-cache/bin/varnishd/cache_session.c index 7ec600fb..2cb3c538 100644 --- a/varnish-cache/bin/varnishd/cache_session.c +++ b/varnish-cache/bin/varnishd/cache_session.c @@ -49,6 +49,7 @@ static unsigned ses_qp; TAILQ_HEAD(srcaddrhead ,srcaddr); static struct srcaddrhead srcaddr_hash[CLIENT_HASH]; static pthread_mutex_t ses_mtx; +static pthread_mutex_t stat_mtx; static pthread_mutex_t ses_mem_mtx; /*-------------------------------------------------------------------- @@ -152,7 +153,7 @@ SES_Charge(struct sess *sp) ses_sum_acct(&sp->acct, a); - LOCK(&ses_mtx); + LOCK(&stat_mtx); ses_sum_acct(b, a); VSL(SLT_StatAddr, 0, "%s 0 %d %ju %ju %ju %ju %ju %ju %ju", sp->srcaddr->addr, time(NULL) - b->first, @@ -165,7 +166,7 @@ SES_Charge(struct sess *sp) VSL_stats->s_fetch += a->fetch; VSL_stats->s_hdrbytes += a->hdrbytes; VSL_stats->s_bodybytes += a->bodybytes; - UNLOCK(&ses_mtx); + UNLOCK(&stat_mtx); memset(a, 0, sizeof *a); } @@ -285,5 +286,6 @@ SES_Init() for (i = 0; i < CLIENT_HASH; i++) TAILQ_INIT(&srcaddr_hash[i]); AZ(pthread_mutex_init(&ses_mtx, NULL)); + AZ(pthread_mutex_init(&stat_mtx, NULL)); AZ(pthread_mutex_init(&ses_mem_mtx, NULL)); }