Commit c75b495d authored by sletz's avatar sletz
Browse files

Fix the mutex/signal classes on Windows.


git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3324 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 77237dd1
This diff is collapsed.
......@@ -47,6 +47,34 @@ void JackWinProcessSync::LockedSignalAll()
ReleaseMutex(fMutex);
}
void JackWinProcessSync::Wait()
{
ReleaseMutex(fMutex);
WaitForSingleObject(fEvent, INFINITE);
}
void JackWinProcessSync::LockedWait()
{
/* Does it make sense on Windows, use non-locked version for now... */
Wait();
}
bool JackWinProcessSync::TimedWait(long usec)
{
ReleaseMutex(fMutex);
DWORD res = WaitForSingleObject(fEvent, usec / 1000);
return (res == WAIT_OBJECT_0);
}
bool JackWinProcessSync::LockedTimedWait(long usec)
{
/* Does it make sense on Windows, use non-locked version for now...*/
return TimedWait(usec);
}
/*
Code from CAGuard.cpp : does ot sees to work as expected..
void JackWinProcessSync::Wait()
{
ReleaseMutex(fMutex);
......@@ -59,8 +87,6 @@ void JackWinProcessSync::Wait()
void JackWinProcessSync::LockedWait()
{
/*
Does it make sense on Windows, use non-locked version for now...
WaitForSingleObject(fMutex, INFINITE);
ReleaseMutex(fMutex);
HANDLE handles[] = { fMutex, fEvent };
......@@ -68,8 +94,6 @@ void JackWinProcessSync::LockedWait()
if ((res != WAIT_OBJECT_0) && (res != WAIT_TIMEOUT))
jack_error("LockedWait error err = %d", GetLastError());
ResetEvent(fEvent);
*/
Wait();
}
bool JackWinProcessSync::TimedWait(long usec)
......@@ -84,8 +108,6 @@ bool JackWinProcessSync::TimedWait(long usec)
bool JackWinProcessSync::LockedTimedWait(long usec)
{
/*
Does it make sense on Windows, use non-locked version for now...
WaitForSingleObject(fMutex, INFINITE);
ReleaseMutex(fMutex);
HANDLE handles[] = { fMutex, fEvent };
......@@ -93,11 +115,9 @@ bool JackWinProcessSync::LockedTimedWait(long usec)
if ((res != WAIT_OBJECT_0) && (res != WAIT_TIMEOUT))
jack_error("LockedTimedWait error err = %d", GetLastError());
ResetEvent(fEvent);
return (res == WAIT_OBJECT_0);
*/
return TimedWait(usec);
return (res == WAIT_OBJECT_0);
}
*/
} // end of namespace
......
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