Mailing List Archive

r1537 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2007-06-24 11:40:09 +0200 (Sun, 24 Jun 2007)
New Revision: 1537

Modified:
trunk/varnish-cache/bin/varnishd/cache_session.c
Log:
Make sure we cache a consistent view of the workspace size.


Modified: trunk/varnish-cache/bin/varnishd/cache_session.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_session.c 2007-06-24 09:29:21 UTC (rev 1536)
+++ trunk/varnish-cache/bin/varnishd/cache_session.c 2007-06-24 09:40:09 UTC (rev 1537)
@@ -255,9 +255,8 @@
SES_New(struct sockaddr *addr, unsigned len)
{
struct sessmem *sm;
- unsigned u;
+ volatile unsigned u;

-
/*
* One of the two queues is unlocked because only one
* thread ever gets here to empty it.
@@ -279,6 +278,10 @@
} else {
/*
* If that fails, alloc new one.
+ *
+ * It is not necessary to lock mem_workspace, but we
+ * need to cache it locally, to make sure we get a
+ * consistent view of it.
*/
u = params->mem_workspace;
sm = malloc(sizeof *sm + u);