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

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;
}