Adds a compilation test for mcslock
authorPeizhao Ou <peizhaoo@uci.edu>
Fri, 6 Apr 2018 21:38:57 +0000 (14:38 -0700)
committerPeizhao Ou <peizhaoo@uci.edu>
Fri, 6 Apr 2018 21:38:57 +0000 (14:38 -0700)
test/stress/misc/CMakeLists.txt
test/stress/misc/mcslock_test.cpp [new file with mode: 0644]

index 3a7aedc..2fa3d71 100644 (file)
@@ -20,4 +20,7 @@ include_directories(
 add_executable(${PACKAGE_NAME} ${CDSSTRESS_STACK_SOURCES})
 target_link_libraries(${PACKAGE_NAME} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
 
 add_executable(${PACKAGE_NAME} ${CDSSTRESS_STACK_SOURCES})
 target_link_libraries(${PACKAGE_NAME} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
 
+add_executable(mcslock-test mcslock_test.cpp)
+target_link_libraries(mcslock-test ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
+
 add_test(NAME ${PACKAGE_NAME} COMMAND ${PACKAGE_NAME} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
 add_test(NAME ${PACKAGE_NAME} COMMAND ${PACKAGE_NAME} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
diff --git a/test/stress/misc/mcslock_test.cpp b/test/stress/misc/mcslock_test.cpp
new file mode 100644 (file)
index 0000000..960f71e
--- /dev/null
@@ -0,0 +1,25 @@
+#include "common.h"
+#include <atomic>
+#include <cds/gc/dhp.h>
+#include <cds/gc/hp.h>
+#include <cds/misc/mcs-lock.h>
+#include <cds_test/stress_test.h>
+#include <iostream>
+#include <memory>
+#include <thread>
+
+using namespace std;
+
+namespace {
+
+static size_t s_nMCSLockThreadCount = 4;
+static size_t s_nMCSLockPassCount = 3000000;
+
+cds_others::mcs_mutex m;
+
+} // namespace
+
+int main() {
+  cds_others::mcs_mutex::guard g(&m);
+  return 0;
+}