[PATCH 09/13] Add a signal_close callback method to stevedores, which can be used to signal background threads to stop in preparation for the coming close callback.
Martin Blix Grydeland
martin at varnish-software.com
Mon Oct 1 12:26:16 CEST 2012
---
bin/varnishd/storage/stevedore.c | 9 +++++++++
bin/varnishd/storage/storage.h | 2 ++
2 files changed, 11 insertions(+)
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index cd1a316..fa5a683 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -436,6 +436,15 @@ STV_close(void)
{
struct stevedore *stv;
+ /* Signal intent to close */
+ VTAILQ_FOREACH(stv, &stv_stevedores, list)
+ if (stv->signal_close != NULL)
+ stv->signal_close(stv);
+ stv = stv_transient;
+ if (stv->signal_close != NULL)
+ stv->signal_close(stv);
+
+ /* Close each in turn */
VTAILQ_FOREACH(stv, &stv_stevedores, list)
if (stv->close != NULL)
stv->close(stv);
diff --git a/bin/varnishd/storage/storage.h b/bin/varnishd/storage/storage.h
index aae9186..fd1adef 100644
--- a/bin/varnishd/storage/storage.h
+++ b/bin/varnishd/storage/storage.h
@@ -47,6 +47,7 @@ typedef void storage_free_f(struct storage *);
typedef struct object *storage_allocobj_f(struct stevedore *, struct busyobj *,
struct objcore **, unsigned ltot, const struct stv_objsecrets *);
typedef void storage_close_f(const struct stevedore *);
+typedef void storage_signal_close_f(const struct stevedore *);
/* Prototypes for VCL variable responders */
#define VRTSTVTYPE(ct) typedef ct storage_var_##ct(const struct stevedore *);
@@ -69,6 +70,7 @@ struct stevedore {
storage_free_f *free; /* --//-- */
storage_close_f *close; /* --//-- */
storage_allocobj_f *allocobj; /* --//-- */
+ storage_signal_close_f *signal_close; /* --//-- */
struct lru *lru;
--
1.7.9.5
More information about the varnish-dev
mailing list