From a087aacdb97b45716f238d72c644039e31d5bd53 Mon Sep 17 00:00:00 2001 From: Brian Pane Date: Sun, 14 Apr 2002 00:31:43 +0000 Subject: [PATCH] Fixed a race condition git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94640 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/experimental/leader/leader.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/mpm/experimental/leader/leader.c b/server/mpm/experimental/leader/leader.c index 966b7717ff..49f424d581 100644 --- a/server/mpm/experimental/leader/leader.c +++ b/server/mpm/experimental/leader/leader.c @@ -321,6 +321,16 @@ static apr_status_t worker_stack_awaken_next(worker_stack *stack) if ((rv = apr_thread_mutex_unlock(stack->mutex)) != APR_SUCCESS) { return rv; } + /* Acquire and release the idle worker's mutex to ensure + * that it's actually waiting on its condition variable + */ + if ((rv = apr_thread_mutex_lock(wakeup->mutex)) != APR_SUCCESS) { + return rv; + } + if ((rv = apr_thread_mutex_unlock(wakeup->mutex)) != APR_SUCCESS) { + return rv; + } + apr_thread_mutex_unlock(wakeup->mutex); if ((rv = apr_thread_cond_signal(wakeup->cond)) != APR_SUCCESS) { apr_thread_mutex_unlock(stack->mutex); return rv; -- 2.50.1