sync: print proper lock order location when double lock is detected

Before:
```
Assertion failed: detected double lock at src/sync.cpp:153, details in debug log.
```

After:
```
Assertion failed: detected double lock for 'm' in src/test/sync_tests.cpp:40 (in thread ''), details in debug log.
```
This commit is contained in:
Vasil Dimov 2020-11-26 14:16:10 +01:00
parent 50091592dd
commit 6d3689fcf6
No known key found for this signature in database
GPG Key ID: 54DF06F64B55CBBF

View File

@ -150,7 +150,9 @@ static void double_lock_detected(const void* mutex, LockStack& lock_stack)
LogPrintf(" %s\n", i.second.ToString());
}
if (g_debug_lockorder_abort) {
tfm::format(std::cerr, "Assertion failed: detected double lock at %s:%i, details in debug log.\n", __FILE__, __LINE__);
tfm::format(std::cerr,
"Assertion failed: detected double lock for %s, details in debug log.\n",
lock_stack.back().second.ToString());
abort();
}
throw std::logic_error("double lock detected");