test: Add LockStackEmpty()

This commit is contained in:
Hennadii Stepanov committed 2020-08-02 16:42:39 +03:00
1 parent 42b2a95373
commit 63e9e40b73
3 files changed
+21 -6

No files matched your search

+11
View File
@@ -264,6 +264,17 @@ void DeleteLock(void* cs)
}
}
bool LockStackEmpty()
{
LockData& lockdata = GetLockData();
std::lock_guard<std::mutex> lock(lockdata.dd_mutex);
const auto it = lockdata.m_lock_stacks.find(std::this_thread::get_id());
if (it == lockdata.m_lock_stacks.end()) {
return true;
}
return it->second.empty();
}
bool g_debug_lockorder_abort = true;
#endif /* DEBUG_LOCKORDER */