From: Bill Stoddard Date: Wed, 1 May 2002 15:06:44 +0000 (+0000) Subject: Defer starting the listener until we have at least tried to start all the worker X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c4482c2658baa85916d7f0c2916aac3cc63ab0aa;p=apache Defer starting the listener until we have at least tried to start all the worker threads. We want to get the workers in the pool of available threads ASAP to keep perform_idle_server_maintenance from thrashing and starting too many processes prematurely. The code before this patch would dribble workers into the worker pool over an extended period of time and this prevented perform_idle_server_maintenance from accurately deciding when new processes were needed. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94889 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index 6564384861..54b461bf13 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -999,6 +999,7 @@ static void * APR_THREAD_FUNC start_threads(apr_thread_t *thd, void *dummy) apr_status_t rv; int i; int threads_created = 0; + int listener_started = 0; int loops; int prev_threads_created; @@ -1061,12 +1062,11 @@ static void * APR_THREAD_FUNC start_threads(apr_thread_t *thd, void *dummy) clean_child_exit(APEXIT_CHILDFATAL); } threads_created++; - if (threads_created == 1) { - /* now that we have a worker thread, it makes sense to create - * a listener thread (we don't want a listener without a worker!) - */ - create_listener_thread(ts); - } + } + /* Start the listener only when there are workers available */ + if (!listener_started && threads_created) { + create_listener_thread(ts); + listener_started = 1; } if (start_thread_may_exit || threads_created == ap_threads_per_child) { break;