MCPcopy Create free account
hub / github.com/LUX-Core/lux / push_lock

Function push_lock

src/sync.cpp:88–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88static void push_lock(void* c, const CLockLocation& locklocation, bool fTry)
89{
90 if (lockstack.get() == NULL)
91 lockstack.reset(new LockStack);
92
93 LogPrint("lock", "Locking: %s\n", locklocation.ToString());
94 dd_mutex.lock();
95
96 (*lockstack).push_back(std::make_pair(c, locklocation));
97
98 if (!fTry) {
99 for (const PAIRTYPE(void*, CLockLocation) & i : (*lockstack)) {
100 if (i.first == c)
101 break;
102
103 std::pair<void*, void*> p1 = std::make_pair(i.first, c);
104 if (lockorders.count(p1))
105 continue;
106 lockorders[p1] = (*lockstack);
107
108 std::pair<void*, void*> p2 = std::make_pair(c, i.first);
109 if (lockorders.count(p2)) {
110 potential_deadlock_detected(p1, lockorders[p2], lockorders[p1]);
111 break;
112 }
113 }
114 }
115 dd_mutex.unlock();
116}
117
118static void pop_lock()
119{

Callers 1

EnterCriticalFunction · 0.85

Calls 9

LogPrintFunction · 0.85
lockMethod · 0.80
getMethod · 0.45
resetMethod · 0.45
ToStringMethod · 0.45
push_backMethod · 0.45
countMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected