From: Amaury Denoyelle Date: Mon, 9 Aug 2021 13:02:56 +0000 (+0200) Subject: MINOR: global: define MODE_STOPPING X-Git-Tag: v2.5-dev4~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7afa5c1843521ec3be7549592d2b38ccc9d68b73;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/haproxy/global-t.h b/include/haproxy/global-t.h index a6bc5e1d6d..9c892a7df5 100644 --- a/include/haproxy/global-t.h +++ b/include/haproxy/global-t.h @@ -39,6 +39,7 @@ #define MODE_ZERO_WARNING 0x200 /* warnings cause a failure */ #define MODE_DIAG 0x400 /* extra warnings */ #define MODE_CHECK_CONDITION 0x800 /* -cc mode */ +#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 d09f15c85a..7bc260a405 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2595,6 +2595,7 @@ void deinit(void) __attribute__((noreturn)) void deinit_and_exit(int status) { + global.mode |= MODE_STOPPING; deinit(); exit(status); }