Clean up lockorder data of destroyed mutexes
commit5eeb913d6cff9cfe9a6769d7efe4a7b9f23de0f4
authorPieter Wuille <pieter.wuille@gmail.com>
Fri, 8 Apr 2016 20:14:19 +0000 (8 22:14 +0200)
committerPieter Wuille <pieter.wuille@gmail.com>
Sun, 10 Apr 2016 12:27:10 +0000 (10 14:27 +0200)
tree7acd0460c216efe835e8454f0665286c5442c05a
parent0afac87e8173dd71616e211aa08dcd59cb5cf90e
Clean up lockorder data of destroyed mutexes

The lockorder potential deadlock detection works by remembering for each
lock A that is acquired while holding another B the pair (A,B), and
triggering a warning when (B,A) already exists in the table.

A and B in the above text are represented by pointers to the CCriticalSection
object that is acquired. This does mean however that we need to clean up the
table entries that refer to any critical section which is destroyed, as it
memory address can potentially be used for another unrelated lock in the future.

Implement this clean up by remembering not only the pairs in forward direction,
but also backward direction. This allows for fast iteration over all pairs that
use a deleted CCriticalSection in either the first or the second position.
src/sync.cpp
src/sync.h