]> granicus.if.org Git - apache/commitdiff
Some code transformations to improve the generated assembly
authorBrian Pane <brianp@apache.org>
Fri, 19 Apr 2002 08:02:00 +0000 (08:02 +0000)
committerBrian Pane <brianp@apache.org>
Fri, 19 Apr 2002 08:02:00 +0000 (08:02 +0000)
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

index a3fe24e50f842b21ec71e99bf0b50d9c9a70d6f8..3581b473d1bdcdf2b237f624337c84ee15c135c2 100644 (file)
@@ -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 {