From: Brian Pane Date: Sun, 14 Apr 2002 00:31:43 +0000 (+0000) Subject: Fixed a race condition X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4f75f81adf94d783463cda3e5531d6931d817089;p=apache Fixed a race condition git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94640 13f79535-47bb-0310-9956-ffa450edef68 --- 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;