[master] c457b96 serialize STV_next
Nils Goroll
nils.goroll at uplex.de
Wed Nov 9 14:57:04 CET 2016
commit c457b965383087714e3afcce60a763fbec295bb1
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Wed Nov 9 14:55:13 2016 +0100
serialize STV_next
May be a preliminary solution should phk decide to do this differently.
Fixes #2128
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index ef90263..6ecf8ee 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -52,13 +52,16 @@ const struct stevedore *
STV_next()
{
static struct stevedore *stv;
+ static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+ AZ(pthread_mutex_lock(&mtx));
if (!STV__iter(&stv))
AN(STV__iter(&stv));
if (stv == stv_transient) {
stv = NULL;
AN(STV__iter(&stv));
}
+ AZ(pthread_mutex_unlock(&mtx));
AN(stv);
return (stv);
}
More information about the varnish-commit
mailing list