From: Brian Pane Date: Sun, 14 Apr 2002 00:31:43 +0000 (+0000) Subject: Fixed a race condition X-Git-Tag: 2.0.36~207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a087aacdb97b45716f238d72c644039e31d5bd53;p=thirdparty%2Fapache%2Fhttpd.git 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 966b7717ff4..49f424d581b 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;