[4.1] 65f62a3 Add a read/write lock for VCL temperature
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Sep 12 17:57:13 CEST 2016
commit 65f62a3f9ac5f3136bd1ab308b82cfef94c991ca
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Tue Aug 30 20:31:34 2016 +0200
Add a read/write lock for VCL temperature
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 234238b..a2d90eb 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -34,6 +34,7 @@
#include "config.h"
#include <dlfcn.h>
+#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
@@ -68,6 +69,7 @@ struct vcl {
unsigned busy;
unsigned discard;
const char *temp;
+ pthread_rwlock_t temp_rwl;
VTAILQ_HEAD(,backend) backend_list;
VTAILQ_HEAD(,vclref) ref_list;
};
@@ -323,6 +325,7 @@ VCL_Open(const char *fn, struct vsb *msg)
}
ALLOC_OBJ(vcl, VCL_MAGIC);
AN(vcl);
+ AZ(pthread_rwlock_init(&vcl->temp_rwl, NULL));
vcl->dlh = dlh;
vcl->conf = cnf;
return (vcl);
@@ -337,6 +340,7 @@ VCL_Close(struct vcl **vclp)
vcl = *vclp;
*vclp = NULL;
AZ(dlclose(vcl->dlh));
+ AZ(pthread_rwlock_destroy(&vcl->temp_rwl));
FREE_OBJ(vcl);
}
More information about the varnish-commit
mailing list