Simplified the timed try lock implementation.

This commit is contained in:
martin-osborne
2014-10-19 18:11:43 +01:00
parent 2a90e7de92
commit 120fd4433c

View File

@@ -128,19 +128,8 @@ bool FastMutexImpl::tryLockImpl(long milliseconds)
{ {
try try
{ {
if (TryEnterCriticalSection(&_cs) == TRUE) if (tryLockImpl())
{ return true;
if (_lockCount == 0)
{
++_lockCount;
return true;
}
// We're trying to go recursive
LeaveCriticalSection(&_cs);
Sleep(milliseconds);
return false;
}
} }
catch (...) catch (...)
{ {