mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Add ability to assert a lock is not held in DEBUG_LOCKORDER
This commit is contained in:
parent
0343676ce3
commit
2b4b34503f
2 changed files with 13 additions and 0 deletions
10
src/sync.cpp
10
src/sync.cpp
|
|
@ -155,6 +155,16 @@ void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine,
|
|||
abort();
|
||||
}
|
||||
|
||||
void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs)
|
||||
{
|
||||
for (const std::pair<void*, CLockLocation>& i : *lockstack) {
|
||||
if (i.first == cs) {
|
||||
fprintf(stderr, "Assertion failed: lock %s held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld().c_str());
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteLock(void* cs)
|
||||
{
|
||||
if (!lockdata.available) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue