diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-06-20 23:00:52 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-08-02 16:42:39 +0300 |
commit | 63e9e40b73507b0c9361fc8728d4e97fd72c9ec9 (patch) | |
tree | 681300eb961c2cbfb2a82a8d026ad5c04e07f792 /src/sync.cpp | |
parent | 42b2a953735457cbf7b62a18b89811a66e573298 (diff) |
test: Add LockStackEmpty()
Diffstat (limited to 'src/sync.cpp')
-rw-r--r-- | src/sync.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sync.cpp b/src/sync.cpp index f72436530e..4be13a3c48 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -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 */ |