From 1c3a94b86c1ca97178e029fff42b0ab90f508a79 Mon Sep 17 00:00:00 2001 From: Brian Pane Date: Fri, 19 Apr 2002 08:02:00 +0000 Subject: [PATCH] Some code transformations to improve the generated assembly code within the critical region inside the spin locks. (Shortening this code path reduces the probability that we'll have to spin.) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94706 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/experimental/leader/leader.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server/mpm/experimental/leader/leader.c b/server/mpm/experimental/leader/leader.c index a3fe24e50f..3581b473d1 100644 --- a/server/mpm/experimental/leader/leader.c +++ b/server/mpm/experimental/leader/leader.c @@ -247,11 +247,11 @@ static apr_proc_mutex_t *accept_mutex; /* Structure used to wake up an idle worker thread */ struct worker_wakeup_info { - apr_thread_cond_t *cond; - apr_thread_mutex_t *mutex; apr_uint32_t next; /* index into worker_wakeups array, * used to build a linked list */ + apr_thread_cond_t *cond; + apr_thread_mutex_t *mutex; }; static worker_wakeup_info *worker_wakeup_create(apr_pool_t *pool) @@ -349,9 +349,8 @@ static apr_status_t worker_stack_awaken_next(worker_stack *stack) } else { worker_wakeup_info *wakeup = worker_wakeups[first]; - apr_uint32_t new_state = state & ~STACK_FIRST; - new_state |= wakeup->next; - if (apr_atomic_cas(&(stack->state), new_state, state) != state) { + if (apr_atomic_cas(&(stack->state), (state ^ first) | wakeup->next, + state) != state) { continue; } else { -- 2.50.1