]> granicus.if.org Git - apache/commitdiff
switch back to the worker's version of the pod code
authorBrian Pane <brianp@apache.org>
Fri, 12 Apr 2002 04:24:44 +0000 (04:24 +0000)
committerBrian Pane <brianp@apache.org>
Fri, 12 Apr 2002 04:24:44 +0000 (04:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94616 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/experimental/leader/Makefile.in
server/mpm/experimental/leader/leader.c
server/mpm/experimental/leader/mpm.h

index 03f1765edd87e061578d642648c345d509297883..acd46f357bc645af5be7f6be9866f604ffc9a8e4 100644 (file)
@@ -1,5 +1,5 @@
 
 LTLIBRARY_NAME    = libleader.la
-LTLIBRARY_SOURCES = leader.c
+LTLIBRARY_SOURCES = leader.c pod.c
 
 include $(top_srcdir)/build/ltlib.mk
index 4320dd64d6aa2f0c3eb5f89ca72ff7d24fc0b446..2b5def003484f42ec9e1c8edb7ba6bd9d6e53661 100644 (file)
 #include "http_connection.h"
 #include "ap_mpm.h"
 #include "mpm_common.h"
+#include "pod.h"
 #include "ap_listen.h"
 #include "scoreboard.h" 
 #include "mpm_default.h"
@@ -337,7 +338,6 @@ static apr_status_t worker_stack_awaken_next(worker_stack *stack)
 static worker_stack *idle_worker_stack;
 
 #define ST_INIT              0
-#define ST_RESTART           0
 #define ST_GRACEFUL          1
 #define ST_UNGRACEFUL        2
 
@@ -1171,33 +1171,24 @@ static void child_main(int child_num_arg)
                 /* see if termination was triggered while we slept */
                 switch(terminate_mode) {
                 case ST_GRACEFUL:
-                    rv = ST_GRACEFUL;
+                    rv = AP_GRACEFUL;
                     break;
                 case ST_UNGRACEFUL:
-                    rv = ST_RESTART;
+                    rv = AP_RESTART;
                     break;
                 }
             }
-            if (rv == ST_GRACEFUL || rv == ST_RESTART) {
-                /* make sure the start thread has finished; 
-                 * signal_threads() and join_workers depend on that
-                 */
-                join_start_thread(start_thread_id);
-                signal_threads(rv == ST_GRACEFUL ? ST_GRACEFUL : ST_UNGRACEFUL);
-                break;
-            }
         }
 
-        if (rv == ST_GRACEFUL) {
-            /* A terminating signal was received. Now join each of the
-             * workers to clean them up.
-             *   If the worker already exited, then the join frees
-             *   their resources and returns.
-             *   If the worker hasn't exited, then this blocks until
-             *   they have (then cleans up).
-             */
-            join_workers(threads);
-        }
+        signal_threads(ST_GRACEFUL);
+        /* A terminating signal was received. Now join each of the
+         * workers to clean them up.
+         *   If the worker already exited, then the join frees
+         *   their resources and returns.
+         *   If the worker hasn't exited, then this blocks until
+         *   they have (then cleans up).
+         */
+        join_workers(threads);
     }
 
     free(threads);
@@ -1379,7 +1370,7 @@ static void perform_idle_server_maintenance(void)
 
     if (idle_thread_count > max_spare_threads) {
         /* Kill off one child */
-        ap_mpm_pod_signal(pod);
+        ap_mpm_pod_signal(pod, TRUE);
         idle_spawn_rate = 1;
     }
     else if (idle_thread_count < min_spare_threads) {
@@ -1609,7 +1600,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
          * (By "gracefully" we don't mean graceful in the same sense as 
          * "apachectl graceful" where we allow old connections to finish.)
          */
-        ap_mpm_pod_killpg(pod, ap_daemons_limit);
+        ap_mpm_pod_killpg(pod, ap_daemons_limit, FALSE);
         ap_reclaim_child_processes(1);                /* Start with SIGTERM */
 
         if (!child_fatal) {
@@ -1647,7 +1638,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
                      AP_SIG_GRACEFUL_STRING " received.  Doing graceful restart");
         /* wake up the children...time to die.  But we'll have more soon */
-        ap_mpm_pod_killpg(pod, ap_daemons_limit);
+        ap_mpm_pod_killpg(pod, ap_daemons_limit, TRUE);
     
 
         /* This is mostly for debugging... so that we know what is still
@@ -1660,7 +1651,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
          * and a SIGHUP, we may as well use the same signal, because some user
          * pthreads are stealing signals from us left and right.
          */
-        ap_mpm_pod_killpg(pod, ap_daemons_limit);
+        ap_mpm_pod_killpg(pod, ap_daemons_limit, FALSE);
 
         ap_reclaim_child_processes(1);                /* Start with SIGTERM */
         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
index 5e7afa8fde84bb091f96758da8a9c1a3fc2e9d62..38074f9361c1b06f2c51e20d56cecbea0f5caeed 100644 (file)
@@ -76,7 +76,6 @@
 #define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
 #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
 
-#define AP_MPM_USES_POD 1
 #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
 #define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0)
 #define MPM_ACCEPT_FUNC unixd_accept