mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
Preserve initial state if push_lock() throws exception
This commit is contained in:
parent
a78742830a
commit
1f96be25b0
1 changed files with 8 additions and 3 deletions
11
src/sync.cpp
11
src/sync.cpp
|
@ -149,12 +149,17 @@ static void push_lock(void* c, const CLockLocation& locklocation)
|
|||
const LockPair p1 = std::make_pair(i.first, c);
|
||||
if (lockdata.lockorders.count(p1))
|
||||
continue;
|
||||
lockdata.lockorders.emplace(p1, lock_stack);
|
||||
|
||||
const LockPair p2 = std::make_pair(c, i.first);
|
||||
if (lockdata.lockorders.count(p2)) {
|
||||
auto lock_stack_copy = lock_stack;
|
||||
lock_stack.pop_back();
|
||||
potential_deadlock_detected(p1, lockdata.lockorders[p2], lock_stack_copy);
|
||||
// potential_deadlock_detected() does not return.
|
||||
}
|
||||
|
||||
lockdata.lockorders.emplace(p1, lock_stack);
|
||||
lockdata.invlockorders.insert(p2);
|
||||
if (lockdata.lockorders.count(p2))
|
||||
potential_deadlock_detected(p1, lockdata.lockorders[p2], lockdata.lockorders[p1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue