Refactors some of existing cds multi-threaded stress test cases
[libcds.git] / test / stress / misc / deque_driver.cpp
index 8976c3c..7d933ad 100644 (file)
@@ -12,7 +12,7 @@ using namespace std;
 namespace {
 
 typedef cds_others::ChaseLevDeque Deque;
-static size_t s_nDequeStealerThreadCount = 5;
+static size_t s_nDequeStealerThreadCount = 3;
 static size_t s_nDequeMainPassCount = 100000000;
 
 class ChaseLevDequeTest : public cds_test::stress_fixture {
@@ -32,10 +32,14 @@ protected:
 
   static void StealerThread(int index) {
     while (!terminate_stealer.load(memory_order_relaxed)) {
-      int res = deque->steal();
-      if (res != EMPTY && res != ABORT) {
-        sums[index] += res;
-        succ_counts[index]++;
+      while (true) {
+        int res = deque->steal();
+        if (res != EMPTY && res != ABORT) {
+          sums[index] += res;
+          succ_counts[index]++;
+        } else {
+          break;
+        }
       }
     }
   }