Skip to content

Commit

Permalink
another mutex test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreRouma committed Jun 26, 2024
1 parent beb1897 commit e613087
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions min_broken/main.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
#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;
std::recursive_mutex mtx;

int main() {
printf("Value: %d\n", test.getValue());
std::lock_guard<std::recursive_mutex> lck(mtx);
return 0;
}

0 comments on commit e613087

Please sign in to comment.