Commit b04b136c authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

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.
parent b468fff3
...@@ -436,6 +436,15 @@ STV_close(void) ...@@ -436,6 +436,15 @@ STV_close(void)
{ {
struct stevedore *stv; 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) VTAILQ_FOREACH(stv, &stv_stevedores, list)
if (stv->close != NULL) if (stv->close != NULL)
stv->close(stv); stv->close(stv);
......
...@@ -47,6 +47,7 @@ typedef void storage_free_f(struct storage *); ...@@ -47,6 +47,7 @@ typedef void storage_free_f(struct storage *);
typedef struct object *storage_allocobj_f(struct stevedore *, struct busyobj *, typedef struct object *storage_allocobj_f(struct stevedore *, struct busyobj *,
struct objcore **, unsigned ltot, const struct stv_objsecrets *); struct objcore **, unsigned ltot, const struct stv_objsecrets *);
typedef void storage_close_f(const struct stevedore *); typedef void storage_close_f(const struct stevedore *);
typedef void storage_signal_close_f(const struct stevedore *);
/* Prototypes for VCL variable responders */ /* Prototypes for VCL variable responders */
#define VRTSTVTYPE(ct) typedef ct storage_var_##ct(const struct stevedore *); #define VRTSTVTYPE(ct) typedef ct storage_var_##ct(const struct stevedore *);
...@@ -69,6 +70,7 @@ struct stevedore { ...@@ -69,6 +70,7 @@ struct stevedore {
storage_free_f *free; /* --//-- */ storage_free_f *free; /* --//-- */
storage_close_f *close; /* --//-- */ storage_close_f *close; /* --//-- */
storage_allocobj_f *allocobj; /* --//-- */ storage_allocobj_f *allocobj; /* --//-- */
storage_signal_close_f *signal_close; /* --//-- */
struct lru *lru; struct lru *lru;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment