From: Brian Pane Date: Sat, 13 Apr 2002 07:00:32 +0000 (+0000) Subject: Fixed the shutdown logic X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62e187fdecd835b567b0cb627572253b6ea59c82;p=apache Fixed the shutdown logic git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94630 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/experimental/leader/leader.c b/server/mpm/experimental/leader/leader.c index 2b5def0034..966b7717ff 100644 --- a/server/mpm/experimental/leader/leader.c +++ b/server/mpm/experimental/leader/leader.c @@ -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);