diff --git a/src/sync.h b/src/sync.h index aed8c697b5..78febe1e0a 100644 --- a/src/sync.h +++ b/src/sync.h @@ -149,10 +149,11 @@ private: bool TryEnter(const char* pszName, const char* pszFile, int nLine) { EnterCritical(pszName, pszFile, nLine, Base::mutex(), true); - Base::try_lock(); - if (!Base::owns_lock()) - LeaveCritical(); - return Base::owns_lock(); + if (Base::try_lock()) { + return true; + } + LeaveCritical(); + return false; } public: