[master] b04b136 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-cache.org
Wed Oct 10 09:49:18 CEST 2012


commit b04b136cb52ef420002a29f28e1a0bcb8cbe1770
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Thu Sep 27 14:43:55 2012 +0200

    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.

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;
 



More information about the varnish-commit mailing list