Fix compiler warning: unused return value
authorsvost <ya.nowa@yandex.ru>
Sun, 3 Mar 2024 10:01:39 +0000 (13:01 +0300)
committersvost <ya.nowa@yandex.ru>
Sun, 3 Mar 2024 10:01:39 +0000 (13:01 +0300)
src/sync.h

index e532c6b..c5ee38f 100644 (file)
@@ -65,11 +65,11 @@ public:
         if (!lock.owns_lock())
         {
             EnterCritical(pszName, pszFile, nLine, (void*)(lock.mutex()), true);
-            lock.try_lock();
-            if (!lock.owns_lock())
-                LeaveCritical();
+            if (lock.try_lock())
+                return true;
+            LeaveCritical();
         }
-        return lock.owns_lock();
+        return false;
     }
 
     CMutexLock(Mutex& mutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) : lock(mutexIn, std::defer_lock)