Skip to content

Commit 30cc1c6

Browse files
hebastovasild
andcommitted
refactor: Drop owns_lock() call
Co-authored-by: Vasil Dimov <[email protected]>
1 parent bff4e06 commit 30cc1c6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/sync.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,11 @@ class SCOPED_LOCKABLE UniqueLock : public Base
165165
bool TryEnter(const char* pszName, const char* pszFile, int nLine)
166166
{
167167
EnterCritical(pszName, pszFile, nLine, Base::mutex(), true);
168-
if (!Base::try_lock()) {
169-
LeaveCritical();
168+
if (Base::try_lock()) {
169+
return true;
170170
}
171-
return Base::owns_lock();
171+
LeaveCritical();
172+
return false;
172173
}
173174

174175
public:

0 commit comments

Comments
 (0)