Commit e16006d7 authored by sletz's avatar sletz
Browse files

Add Trylock method

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2116 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 3d97601d
......@@ -64,6 +64,11 @@ class JackMutex
DWORD dwWaitResult = WaitForSingleObject(fMutex, INFINITE);
}
bool Trylock()
{
return (WAIT_OBJECT_0 == WaitForSingleObject(fMutex, 0));
}
void Unlock()
{
ReleaseMutex(fMutex);
......@@ -89,6 +94,11 @@ class JackMutex
pthread_mutex_lock(&fMutex);
}
bool Trylock()
{
return (pthread_mutex_trylock(&fMutex) == 0);
}
void Unlock()
{
pthread_mutex_unlock(&fMutex);
......@@ -116,7 +126,12 @@ class JackLockAble
fMutex.Lock();
}
void Unlock()
bool Trylock()
{
return fMutex.Trylock();
}
void Unlock()
{
fMutex.Unlock();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment