Release `LockData::dd_mutex` before calling `*_detected` functions
Both double_lock_detected()
and potential_deadlock_detected()
functions call LogPrintf()
which in turn implies locking of the Logger::m_cs
mutex. To avoid a deadlock, the latter must not have the Mutex
type (see https://github.com/bitcoin/bitcoin/pull/16112).
With this PR the mentioned restriction has been lifted, and it is possible now to use our regular Mutex
type for the Logger::m_cs
mutex instead of a dedicated StdMutex
type (not introducing that change here, as its diff is much bigger than a few lines, and the currently proposed diff seems valuable by itself).
Note for reviewers: Make sure the code is configured and built with CPPFLAGS=-DDEBUG_LOCKORDER
.