2 #include <cds/gc/dhp.h>
4 #include <cds/sync/mcs-lock.h>
5 #include <cds_test/stress_test.h>
13 class MCSLockTest : public cds_test::stress_fixture {
16 static cds_others::mcs_mutex *my_mutex;
17 static const int kThreads = 6;
19 static void SetUpTestCase() {}
21 static void Thread() {
22 cds_others::mcs_mutex::guard g(my_mutex);
25 for (int i = 0; i < 10000; i++) {
26 for (int j = 0; j < 300; j++) {
37 cds_others::mcs_mutex *MCSLockTest::my_mutex;
38 const int MCSLockTest::kThreads;
40 TEST_F(MCSLockTest, BasicLockUnlock) {
41 my_mutex = new cds_others::mcs_mutex();
42 std::thread threads[kThreads];
43 for (int i = 0; i < kThreads; i++) {
44 threads[i] = std::thread(Thread);
47 for (int i = 0; i < kThreads; i++) {