From: Jeff Trawick Date: Wed, 17 Dec 2003 02:16:44 +0000 (+0000) Subject: add support for querying MPM state to ap_mpm_query() for the WinNT MPM X-Git-Tag: pre_ajp_proxy~912 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e5dcba82caee8899ecb6f660da13a085f871e9b;p=apache add support for querying MPM state to ap_mpm_query() for the WinNT MPM git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102081 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/winnt/child.c b/server/mpm/winnt/child.c index 72a66254f5..70dc1ac529 100644 --- a/server/mpm/winnt/child.c +++ b/server/mpm/winnt/child.c @@ -92,7 +92,6 @@ HANDLE exit_event; /* child_main() should never need to modify is_graceful!?! */ extern int volatile is_graceful; - /* Queue for managing the passing of COMP_CONTEXTs between * the accept and worker threads. */ @@ -926,6 +925,7 @@ void child_main(apr_pool_t *pconf) if (!listener_started && threads_created) { create_listener_thread(); listener_started = 1; + winnt_mpm_state = AP_MPMQ_RUNNING; } if (threads_created == ap_threads_per_child) { break; @@ -1004,6 +1004,8 @@ void child_main(apr_pool_t *pconf) */ shutdown: + + winnt_mpm_state = AP_MPMQ_STOPPING; /* Setting is_graceful will cause threads handling keep-alive connections * to close the connection after handling the current request. */ diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index 6b095d7399..75b4380ca3 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -107,6 +107,7 @@ int use_acceptex = 1; static int thread_limit = DEFAULT_THREAD_LIMIT; static int first_thread_limit = 0; static int changed_limit_at_restart; +int winnt_mpm_state = AP_MPMQ_STARTING; /* ap_my_generation are used by the scoreboard code */ ap_generation_t volatile ap_my_generation=0; @@ -312,6 +313,7 @@ AP_DECLARE(void) ap_signal_parent(ap_signal_parent_e type) switch(type) { case SIGNAL_PARENT_SHUTDOWN: { + winnt_mpm_state = AP_MPMQ_STOPPING; SetEvent(shutdown_event); break; } @@ -319,6 +321,7 @@ AP_DECLARE(void) ap_signal_parent(ap_signal_parent_e type) case SIGNAL_PARENT_RESTART: case SIGNAL_PARENT_RESTART_GRACEFUL: { + winnt_mpm_state = AP_MPMQ_STOPPING; is_graceful = 1; SetEvent(restart_event); break; @@ -330,6 +333,7 @@ AP_DECLARE(void) ap_signal_parent(ap_signal_parent_e type) switch(type) { case SIGNAL_PARENT_SHUTDOWN: { + winnt_mpm_state = AP_MPMQ_STOPPING; signal_name = signal_shutdown_name; break; } @@ -337,6 +341,7 @@ AP_DECLARE(void) ap_signal_parent(ap_signal_parent_e type) case SIGNAL_PARENT_RESTART: case SIGNAL_PARENT_RESTART_GRACEFUL: { + winnt_mpm_state = AP_MPMQ_STOPPING; signal_name = signal_restart_name; is_graceful = 1; break; @@ -1098,6 +1103,9 @@ AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) case AP_MPMQ_MAX_DAEMONS: *result = 0; return APR_SUCCESS; + case AP_MPMQ_MPM_STATE: + *result = winnt_mpm_state; + return APR_SUCCESS; } return APR_ENOTIMPL; } diff --git a/server/mpm/winnt/mpm_winnt.h b/server/mpm/winnt/mpm_winnt.h index d615943bc9..3804a31c04 100644 --- a/server/mpm/winnt/mpm_winnt.h +++ b/server/mpm/winnt/mpm_winnt.h @@ -102,6 +102,7 @@ void mpm_nt_eventlog_stderr_flush(void); /* From winnt.c: */ extern int use_acceptex; +extern int winnt_mpm_state; extern OSVERSIONINFO osver; extern void clean_child_exit(int);