mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-24 00:34:44 +01:00
26 lines
421 B
C++
26 lines
421 B
C++
#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;
|
|
} |