Refactors sequential misc test cases
[libcds.git] / test / stress / sequential / sequential-misc / mcslock_driver.cpp
index d0b83cb6670bb55d2679df0c285b0a39cae615a2..576193f542936be1ffecd74b62ac5cfaf590016e 100644 (file)
@@ -18,32 +18,19 @@ static size_t s_nMCSLockPassCount = 3000000;
 class MCSLockTest : public cds_test::stress_fixture {
 protected:
   static ullong x;
 class MCSLockTest : public cds_test::stress_fixture {
 protected:
   static ullong x;
-  static cds_others::mcs_mutex *my_mutex;
 
   static void SetUpTestCase() {
     cds_test::config const &cfg = get_config("SequentialMisc");
     GetConfig(MCSLockPassCount);
     GetConfig(MCSLockThreadCount);
   }
 
   static void SetUpTestCase() {
     cds_test::config const &cfg = get_config("SequentialMisc");
     GetConfig(MCSLockPassCount);
     GetConfig(MCSLockThreadCount);
   }
-
-  static void Thread() {
-    cds_others::mcs_mutex::guard g(my_mutex);
-    my_mutex->unlock(&g);
-    for (ullong i = 0; i < s_nMCSLockPassCount; i++) {
-      my_mutex->lock(&g);
-      x++;
-      my_mutex->unlock(&g);
-    }
-    my_mutex->lock(&g);
-  }
 };
 
 ullong MCSLockTest::x;
 };
 
 ullong MCSLockTest::x;
-cds_others::mcs_mutex *MCSLockTest::my_mutex;
 
 TEST_F(MCSLockTest, MCSLock) {
 
 TEST_F(MCSLockTest, MCSLock) {
-  my_mutex = new cds_others::mcs_mutex();
-  cds_others::mcs_mutex::guard g(my_mutex);
+  std::unique_ptr<cds_others::mcs_mutex> my_mutex(new cds_others::mcs_mutex());
+  cds_others::mcs_mutex::guard g(my_mutex.get());
   my_mutex->unlock(&g);
   for (size_t i = 0; i < s_nMCSLockPassCount; i++) {
     my_mutex->lock(&g);
   my_mutex->unlock(&g);
   for (size_t i = 0; i < s_nMCSLockPassCount; i++) {
     my_mutex->lock(&g);