Takes out backoff in misc data structures
authorPeizhao Ou <peizhaoo@uci.edu>
Tue, 13 Mar 2018 02:46:31 +0000 (19:46 -0700)
committerPeizhao Ou <peizhaoo@uci.edu>
Tue, 13 Mar 2018 02:46:31 +0000 (19:46 -0700)
cds/misc/barrier.h
cds/misc/mcs-lock.h
cds/misc/rwlock.h
cds/misc/seqlock.h
cds/misc/ticket_lock.h

index 6d0366c..cb20a3f 100644 (file)
@@ -32,10 +32,10 @@ public:
       step_.fetch_add(1, std::memory_order_release);
       return true;
     } else {
-      ExpBackoff backoff;
+//      ExpBackoff backoff;
       /* Run in circles and scream like a little girl.  */
       while (step_.load(std::memory_order_acquire) == step) {
-        backoff();
+//        backoff();
       }
       return false;
     }
index a6eb04e..77068f2 100644 (file)
@@ -63,9 +63,9 @@ public:
 
       // now this is the spin -
       // wait on predecessor setting my flag -
-      ExpBackoff backoff;
+//      ExpBackoff backoff;
       while (me->gate.load(std::memory_order_acquire)) {
-        backoff();
+//        backoff();
       }
     }
   }
@@ -84,12 +84,12 @@ public:
       }
 
       // (*1) catch the race :
-      ExpBackoff backoff;
+//      ExpBackoff backoff;
       for (;;) {
         next = me->next.load(std::memory_order_acquire);
         if (next != nullptr)
           break;
-        backoff();
+//        backoff();
       }
     }
 
index e8c6465..a1f8771 100644 (file)
@@ -31,12 +31,12 @@ public:
   }
 
   void read_lock() {
-    ExpBackoff backoff;
+//    ExpBackoff backoff;
     int priorvalue = atomic_fetch_sub_explicit(&lock, 1, memory_order_acquire);
     while (priorvalue <= 0) {
       atomic_fetch_add_explicit(&lock, 1, memory_order_relaxed);
       while (atomic_load_explicit(&lock, memory_order_relaxed) <= 0) {
-        backoff();
+//        backoff();
       }
       priorvalue = atomic_fetch_sub_explicit(&lock, 1, memory_order_acquire);
     }
@@ -45,12 +45,12 @@ public:
   void write_lock() {
     int priorvalue =
         atomic_fetch_sub_explicit(&lock, RW_LOCK_BIAS, memory_order_acquire);
-    ExpBackoff backoff;
+//    ExpBackoff backoff;
     while (priorvalue != RW_LOCK_BIAS) {
       atomic_fetch_add_explicit(&lock, RW_LOCK_BIAS, memory_order_relaxed);
       while (atomic_load_explicit(&lock, memory_order_relaxed) !=
              RW_LOCK_BIAS) {
-        backoff();
+//        backoff();
       }
       priorvalue =
           atomic_fetch_sub_explicit(&lock, RW_LOCK_BIAS, memory_order_acquire);
index 7427053..6457769 100644 (file)
@@ -25,11 +25,11 @@ public:
   }
 
   int read() {
-    ExpBackoff backoff;
+//    ExpBackoff backoff;
     while (true) {
       int old_seq = seq_.load(memory_order_acquire);
       if (old_seq % 2 == 1) {
-        backoff();
+//        backoff();
         continue;
       }
 
@@ -41,12 +41,12 @@ public:
   }
 
   void write(int new_data) {
-    ExpBackoff backoff;
+//    ExpBackoff backoff;
     while (true) {
       // This might be a relaxed too
       int old_seq = seq_.load(memory_order_acquire);
       if (old_seq % 2 == 1) {
-        backoff();
+//        backoff();
         continue; // Retry
       }
 
index 233b440..b2d3f88 100644 (file)
@@ -24,14 +24,14 @@ public:
     // First grab a ticket
     unsigned my_ticket = ticket.fetch_add(1, std::memory_order_relaxed);
     // Spinning for my turn
-    ExpBackoff backoff;
+//    ExpBackoff backoff;
     while (true) {
       unsigned my_turn = turn.load(std::memory_order_acquire);
       if (my_turn == my_ticket) {
         // Now it's my turn
         return;
       } else {
-        backoff();
+//        backoff();
       }
     }
   }