MINOR: global: define MODE_STOPPING
Define a new mode MODE_STOPPING. It is used to indicate that the process
is in the stopping stage and no event loop runs anymore.
(cherry picked from commit 7afa5c1843521ec3be7549592d2b38ccc9d68b73)
[ad: adjusted context: check mode not implemented in 2.4]
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
diff --git a/include/haproxy/global-t.h b/include/haproxy/global-t.h
index 633bbb5..e52bf1e 100644
--- a/include/haproxy/global-t.h
+++ b/include/haproxy/global-t.h
@@ -38,6 +38,7 @@
#define MODE_MWORKER_WAIT 0x100 /* Master Worker wait mode */
#define MODE_ZERO_WARNING 0x200 /* warnings cause a failure */
#define MODE_DIAG 0x400 /* extra warnings */
+#define MODE_STOPPING 0x1000 /* the process is in the deinit phase, the event loop is not running anymore. */
/* list of last checks to perform, depending on config options */
#define LSTCHK_CAP_BIND 0x00000001 /* check that we can bind to any port */
diff --git a/src/haproxy.c b/src/haproxy.c
index 0e044d8..416f28b 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -2574,6 +2574,7 @@
__attribute__((noreturn)) void deinit_and_exit(int status)
{
+ global.mode |= MODE_STOPPING;
deinit();
exit(status);
}