diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-10-03 12:26:37 +0100 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-10-03 12:26:37 +0100 |
commit | 30cc1c6609ad7868f73e88afe0b0233d395ec08c (patch) | |
tree | ce09e818153bd501c481df30e1cfab0517d51c63 /src/sync.h | |
parent | bff4e068b69edd40a00466156f860bde2df29268 (diff) |
refactor: Drop `owns_lock()` call
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
Diffstat (limited to 'src/sync.h')
-rw-r--r-- | src/sync.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sync.h b/src/sync.h index a4f4d1ac8d..a9d0091bd2 100644 --- a/src/sync.h +++ b/src/sync.h @@ -165,10 +165,11 @@ private: bool TryEnter(const char* pszName, const char* pszFile, int nLine) { EnterCritical(pszName, pszFile, nLine, Base::mutex(), true); - if (!Base::try_lock()) { - LeaveCritical(); + if (Base::try_lock()) { + return true; } - return Base::owns_lock(); + LeaveCritical(); + return false; } public: |