MCPcopy Create free account
hub / github.com/Extra-Creativity/Modern-Cpp-Basics / MyMutex

Class MyMutex

13-Multithreading/code/deadlock_avoidance.cpp:8–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6using namespace std::literals;
7
8class MyMutex : public std::mutex
9{
10public:
11 void lock()
12 {
13 std::this_thread::sleep_for(1s);
14 std::mutex::lock();
15 }
16};
17
18void WorkerDeadlock(int id, MyMutex& mut1, MyMutex& mut2)
19{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected