summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Pane <brianp@apache.org>2002-04-19 10:02:00 +0200
committerBrian Pane <brianp@apache.org>2002-04-19 10:02:00 +0200
commit1c3a94b86c1ca97178e029fff42b0ab90f508a79 (patch)
tree9c3588ac4ebb196436db15e8b69dc9efdf96cbc7
parentReplaced the mutex around the idle worker stack with (diff)
downloadapache2-1c3a94b86c1ca97178e029fff42b0ab90f508a79.tar.xz
apache2-1c3a94b86c1ca97178e029fff42b0ab90f508a79.zip
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
-rw-r--r--server/mpm/experimental/leader/leader.c9
1 files 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 {