add minimally broken example

This commit is contained in:
AlexandreRouma 2024-06-08 19:13:18 +02:00
parent 9537ccf2d2
commit b1ad7590cc
2 changed files with 27 additions and 0 deletions

View File

@ -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 ()

26
min_broken/main.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <stdio.h>
#include <mutex>
class TestClass {
public:
TestClass() {
std::lock_guard<std::recursive_mutex> lck(mtx);
value = 42;
}
int getValue() {
std::lock_guard<std::recursive_mutex> lck(mtx);
return value;
}
private:
std::recursive_mutex mtx;
int value = 0;
};
TestClass test;
int main() {
printf("Value: %d\n", test.getValue());
return 0;
}