From b1ad7590ccb2b2cd8e71001e97dc95d283374b01 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sat, 8 Jun 2024 19:13:18 +0200 Subject: [PATCH] add minimally broken example --- CMakeLists.txt | 1 + min_broken/main.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 min_broken/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 0726e57a..efe2aeea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -299,6 +299,7 @@ endif (OPT_BUILD_SCHEDULER) if (MSVC) add_executable(sdrpp "src/main.cpp" "win32/resources.rc") + add_executable(min_broken "min_broken/main.cpp" "win32/resources.rc") else () add_executable(sdrpp "src/main.cpp") endif () diff --git a/min_broken/main.cpp b/min_broken/main.cpp new file mode 100644 index 00000000..843534eb --- /dev/null +++ b/min_broken/main.cpp @@ -0,0 +1,26 @@ +#include +#include + +class TestClass { +public: + TestClass() { + std::lock_guard lck(mtx); + value = 42; + } + + int getValue() { + std::lock_guard lck(mtx); + return value; + } + +private: + std::recursive_mutex mtx; + int value = 0; +}; + +TestClass test; + +int main() { + printf("Value: %d\n", test.getValue()); + return 0; +} \ No newline at end of file