]> granicus.if.org Git - apache/commitdiff
add support for querying MPM state to ap_mpm_query() for the WinNT MPM
authorJeff Trawick <trawick@apache.org>
Wed, 17 Dec 2003 02:16:44 +0000 (02:16 +0000)
committerJeff Trawick <trawick@apache.org>
Wed, 17 Dec 2003 02:16:44 +0000 (02:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102081 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/child.c
server/mpm/winnt/mpm_winnt.c
server/mpm/winnt/mpm_winnt.h

index 72a66254f58e1d8fe10b6736881a9e4d97f5503b..70dc1ac5296503096b780fa69343423823431382 100644 (file)
@@ -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.
      */
index 6b095d73998e7eafedffb162730e60be8786fce1..75b4380ca3f8308f21b9cced0fbe9900ebfd3bb8 100644 (file)
@@ -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;
 } 
index d615943bc951a06b3a612e092907d669fab62622..3804a31c04637c8a6940ecbb1f52d004d30bd012 100644 (file)
@@ -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);