Fix: move wait loop increment before first conditional block
[userspace-rcu.git] / urcu.c
diff --git a/urcu.c b/urcu.c
index 33e35e1d36a722cb2de2f74e8f3a15c8327f3687..8420ee494cef759bc2b87287168bacddc525315c 100644 (file)
--- a/urcu.c
+++ b/urcu.c
@@ -247,12 +247,12 @@ void update_counter_and_wait(void)
         * Wait for each thread URCU_TLS(rcu_reader).ctr count to become 0.
         */
        for (;;) {
+               if (wait_loops < RCU_QS_ACTIVE_ATTEMPTS)
+                       wait_loops++;
                if (wait_loops >= RCU_QS_ACTIVE_ATTEMPTS) {
                        uatomic_dec(&gp_futex);
                        /* Write futex before read reader_gp */
                        smp_mb_master(RCU_MB_GROUP);
-               } else {
-                       wait_loops++;
                }
 
                cds_list_for_each_entry_safe(index, tmp, &registry, node) {
This page took 0.022327 seconds and 4 git commands to generate.