Refactors sequential misc test cases
[libcds.git] / test / stress / sequential / sequential-misc / spinlock_driver.cpp
index 99a4815..6dce812 100644 (file)
@@ -23,7 +23,7 @@ static size_t s_nSpinLockPassCount = 2500000000;
 static size_t s_nTicketLockPassCount = 4000000;
 
 #define TASK(lock_type, lock_ptr, pass_cnt)                                    \
-  static void Thread##lock_type() {                                            \
+  static void Thread##lock_type(lock_type *lock_ptr) {                         \
     for (size_t i = 0; i < pass_cnt; i++) {                                    \
       lock_ptr->lock();                                                        \
       x++;                                                                     \
@@ -33,9 +33,9 @@ static size_t s_nTicketLockPassCount = 4000000;
 
 #define LOCK_TEST(lock_type, lock_ptr, pass_cnt)                               \
   TEST_F(SpinLockTest, lock_type) {                                            \
-    lock_ptr = new lock_type();                                                \
+    std::unique_ptr<lock_type> lock_ptr(new lock_type());                      \
     x = 0;                                                                     \
-    Thread##lock_type();                                                       \
+    Thread##lock_type(lock_ptr.get());                                         \
   }
 
 class SpinLockTest : public cds_test::stress_fixture {