]> granicus.if.org Git - apache/commitdiff
The worker MPM now handles shutdown and restart requests. It
authorRyan Bloom <rbb@apache.org>
Fri, 10 Aug 2001 05:00:27 +0000 (05:00 +0000)
committerRyan Bloom <rbb@apache.org>
Fri, 10 Aug 2001 05:00:27 +0000 (05:00 +0000)
definately isn't perfect, but we do stop the servers correctly.
The biggest problem right now is that SIGHUP causes the server to
just die.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90065 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/mpm/worker/worker.c

diff --git a/CHANGES b/CHANGES
index 046de0f472c8843a16770b84e59a27d06f269dd7..444e881622d03fa33c21d3e2fd80d483c199090a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Changes with Apache 2.0.24-dev
 
+  *) The worker MPM now handles shutdown and restart requests.  It
+     definately isn't perfect, but we do stop the servers correctly.
+     The biggest problem right now is that SIGHUP causes the server to
+     just die.  [Ryan Bloom]
+
 Changes with Apache 2.0.23
 
   *) Use the prefork MPM by default on Unix.  [various]
index 6f4f539044bfeb737c3b5b89782c201f11edee97..6f6211068ef07520610c8d4b06f8773cf1530475 100644 (file)
@@ -505,7 +505,6 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num,
 /* requests_this_child has gone to zero or below.  See if the admin coded
    "MaxRequestsPerChild 0", and keep going in that case.  Doing it this way
    simplifies the hot path in worker_thread */
-
 static void check_infinite_requests(void)
 {
     if (ap_max_requests_per_child) {
@@ -679,14 +678,8 @@ static void *listener_thread(apr_thread_t *thd, void * dummy)
     ap_update_child_status(process_slot, thread_slot, (dying) ? SERVER_DEAD : SERVER_GRACEFUL,
         (request_rec *) NULL);
     dying = 1;
-    apr_lock_acquire(worker_thread_count_mutex);
-    worker_thread_count--;
-    if (worker_thread_count == 0) {
-        /* All the threads have exited, now finish the shutdown process
-         * by signalling the sigwait thread */
-        kill(ap_my_pid, SIGTERM);
-    }
-    apr_lock_release(worker_thread_count_mutex);
+    ap_scoreboard_image->parent[process_slot].quiescing = 1;
+    kill(ap_my_pid, SIGTERM);
 
     return NULL;
 }
@@ -704,6 +697,9 @@ static void *worker_thread(apr_thread_t *thd, void * dummy)
 
     while (!workers_may_exit) {
         ap_queue_pop(worker_queue, &csd, &ptrans);
+        if (!csd) {
+            continue;
+        }
         ap_increase_blanks(worker_queue);
         process_socket(ptrans, csd, process_slot, thread_slot);
         requests_this_child--;
@@ -714,20 +710,7 @@ static void *worker_thread(apr_thread_t *thd, void * dummy)
     ap_update_child_status(process_slot, thread_slot, (dying) ? SERVER_DEAD : SERVER_GRACEFUL,
         (request_rec *) NULL);
     apr_lock_acquire(worker_thread_count_mutex);
-    if (!dying) {
-        /* this is the first thread to exit */
-        if (ap_my_pid == ap_scoreboard_image->parent[process_slot].pid) {
-            /* tell the parent that it may use this scoreboard slot */
-            ap_scoreboard_image->parent[process_slot].quiescing = 1;
-        }   
-        dying = 1;
-    }
     worker_thread_count--;
-    if (worker_thread_count == 0) {
-        /* All the threads have exited, now finish the shutdown process
-         * by signalling the sigwait thread */
-        kill(ap_my_pid, SIGTERM);
-    }
     apr_lock_release(worker_thread_count_mutex);
 
     return NULL;