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++; \
#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 {