MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / push_lock

Function push_lock

src/sync.cpp:78–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78static void push_lock(void* c, const CLockLocation& locklocation, bool fTry)
79{
80 if (lockstack.get() == NULL)
81 lockstack.reset(new LockStack);
82
83 LogPrint(BCLog::LOCK, "Locking: %s\n", locklocation.ToString());
84 dd_mutex.lock();
85
86 (*lockstack).push_back(make_pair(c, locklocation));
87
88 if (!fTry) {
89 for (const auto& i : (*lockstack)) {
90 if (i.first == c) break;
91
92 pair<void*, void*> p1 = make_pair(i.first, c);
93 if (lockorders.count(p1))
94 continue;
95 lockorders[p1] = (*lockstack);
96
97 pair<void*, void*> p2 = make_pair(c, i.first);
98 if (lockorders.count(p2))
99 {
100 potential_deadlock_detected(p1, lockorders[p2], lockorders[p1]);
101 break;
102 }
103 }
104 }
105 dd_mutex.unlock();
106}
107
108static void pop_lock()
109{

Callers 1

EnterCriticalFunction · 0.85

Calls 6

push_backMethod · 0.80
getMethod · 0.45
resetMethod · 0.45
ToStringMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected