]> granicus.if.org Git - apache/commitdiff
Fixed the shutdown logic
authorBrian Pane <brianp@apache.org>
Sat, 13 Apr 2002 07:00:32 +0000 (07:00 +0000)
committerBrian Pane <brianp@apache.org>
Sat, 13 Apr 2002 07:00:32 +0000 (07:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94630 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/experimental/leader/leader.c

index 2b5def003484f42ec9e1c8edb7ba6bd9d6e53661..966b7717ff41b599331bc92bde057f62a37339e7 100644 (file)
@@ -844,13 +844,9 @@ static void *worker_thread(apr_thread_t *thd, void * dummy)
     got_fd:
         if (!workers_may_exit) {
             rv = lr->accept_func(&csd, lr, ptrans);
+            /* later we trash rv and rely on csd to indicate success/failure */
+            AP_DEBUG_ASSERT(rv == APR_SUCCESS || !csd);
 
-            /* If we were interrupted for whatever reason, just start
-             * the main loop over again.
-             */
-            if (APR_STATUS_IS_EINTR(rv)) {
-                continue;
-            }
             if (rv == APR_EGENERAL) {
                 /* E[NM]FILE, ENOMEM, etc */
                 resource_shortage = 1;
@@ -1178,17 +1174,26 @@ static void child_main(int child_num_arg)
                     break;
                 }
             }
+            if (rv == AP_GRACEFUL || rv == AP_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 == AP_GRACEFUL ? ST_GRACEFUL : ST_UNGRACEFUL);
+                break;
+            }
         }
 
-        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);
+        if (rv == AP_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);