r930 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Wed Sep 6 22:45:49 CEST 2006


Author: phk
Date: 2006-09-06 22:45:49 +0200 (Wed, 06 Sep 2006)
New Revision: 930

Modified:
   trunk/varnish-cache/bin/varnishd/cache_session.c
Log:
Give the stats summation its own mutex


Modified: trunk/varnish-cache/bin/varnishd/cache_session.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_session.c	2006-09-06 19:35:33 UTC (rev 929)
+++ trunk/varnish-cache/bin/varnishd/cache_session.c	2006-09-06 20:45:49 UTC (rev 930)
@@ -49,6 +49,7 @@
 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_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 @@
 	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 @@
 	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));
 }




More information about the varnish-commit mailing list