Return-Path: Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 60773 invoked by uid 500); 28 Apr 2002 23:28:53 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 60762 invoked by uid 500); 28 Apr 2002 23:28:53 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 28 Apr 2002 23:28:52 -0000 Message-ID: <20020428232852.16928.qmail@icarus.apache.org> From: aaron@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/server/mpm/experimental/threadpool threadpool.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N aaron 02/04/28 16:28:52 Modified: server/mpm/experimental/threadpool threadpool.c Log: Rename the worker_stack_interrupt_all() function as worker_stack_terminate(). Also, broadcast a signal after we set the terminate flag on the worker stack. Revision Changes Path 1.7 +8 -3 httpd-2.0/server/mpm/experimental/threadpool/threadpool.c Index: threadpool.c =================================================================== RCS file: /home/cvs/httpd-2.0/server/mpm/experimental/threadpool/threadpool.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- threadpool.c 28 Apr 2002 23:10:26 -0000 1.6 +++ threadpool.c 28 Apr 2002 23:28:52 -0000 1.7 @@ -361,6 +361,7 @@ if ((rv = apr_thread_mutex_lock(stack->mutex)) != APR_SUCCESS) { return rv; } + AP_DEBUG_ASSERT(stack->nelts >= 0); while ((stack->nelts == 0) && (!stack->terminated)) { rv = apr_thread_cond_wait(stack->cond, stack->mutex); if (rv != APR_SUCCESS) { @@ -385,7 +386,7 @@ return APR_SUCCESS; } -static apr_status_t worker_stack_interrupt_all(worker_stack *stack) +static apr_status_t worker_stack_terminate(worker_stack *stack) { apr_status_t rv; worker_wakeup_info *worker; @@ -394,6 +395,10 @@ return rv; } stack->terminated = 1; + /* Wake up the listener thread. Although there will never be + * more than one thread blocking on this condition, broadcast + * just in case. */ + apr_thread_cond_broadcast(stack->cond); while (stack->nelts) { worker = stack->stack[--stack->nelts]; apr_thread_mutex_lock(worker->mutex); @@ -472,7 +477,7 @@ */ if (mode == ST_UNGRACEFUL) { workers_may_exit = 1; - worker_stack_interrupt_all(idle_worker_stack); + worker_stack_terminate(idle_worker_stack); } } @@ -994,7 +999,6 @@ } workers_may_exit = 1; - worker_stack_interrupt_all(idle_worker_stack); if (worker) { apr_thread_mutex_lock(worker->mutex); worker->state = WORKER_TERMINATED; @@ -1006,6 +1010,7 @@ apr_thread_cond_signal(worker->cond); apr_thread_mutex_unlock(worker->mutex); } + worker_stack_terminate(idle_worker_stack); dying = 1; ap_scoreboard_image->parent[process_slot].quiescing = 1;