From 27a867488234bb901471e851c7b4d58b1cb3e04f Mon Sep 17 00:00:00 2001 From: sletz Date: Fri, 17 Nov 2006 17:02:25 +0000 Subject: [PATCH] Correct Disconnect git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1298 0c269be4-1314-0410-8aa9-9f06e86f4224 --- windows/JackWinEvent.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/windows/JackWinEvent.cpp b/windows/JackWinEvent.cpp index f87a54c5..af04ba88 100644 --- a/windows/JackWinEvent.cpp +++ b/windows/JackWinEvent.cpp @@ -37,12 +37,13 @@ bool JackWinEvent::Signal() assert(fEvent); if (fFlush) - return true; - + return true; + if (!(res = SetEvent(fEvent))) { jack_error("JackWinEvent::Signal name = %s err = %ld", fName, GetLastError()); - } - return res; + } + + return res; } bool JackWinEvent::SignalAll() @@ -51,12 +52,13 @@ bool JackWinEvent::SignalAll() assert(fEvent); if (fFlush) - return true; - + return true; + if (!(res = SetEvent(fEvent))) { jack_error("JackWinEvent::SignalAll name = %s err = %ld", fName, GetLastError()); - } - return res; + } + + return res; } bool JackWinEvent::Wait() @@ -64,7 +66,8 @@ bool JackWinEvent::Wait() DWORD res; if ((res = WaitForSingleObject(fEvent, INFINITE)) != WAIT_OBJECT_0) { - jack_error("JackWinEvent::Wait name = %s err = %ld", fName, GetLastError()); + if (res == WAIT_TIMEOUT) + jack_error("JackWinEvent::TimedWait name = %s time_out", fName); } return (res == WAIT_OBJECT_0); @@ -72,11 +75,12 @@ bool JackWinEvent::Wait() bool JackWinEvent::TimedWait(long usec) { - DWORD res; + DWORD res; - if ((res = WaitForSingleObject(fEvent, usec / 1000)) != WAIT_OBJECT_0) { - jack_error("JackWinEvent::Wait name = %s err = %ld", fName, GetLastError()); - } + if ((res = WaitForSingleObject(fEvent, usec / 1000)) != WAIT_OBJECT_0) { + if (res == WAIT_TIMEOUT) + jack_error("JackWinEvent::TimedWait name = %s time_out", fName); + } return (res == WAIT_OBJECT_0); } @@ -93,8 +97,8 @@ bool JackWinEvent::ConnectInput(const char* name) return true; } - if ((fEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, fName)) == NULL) { - jack_error("Connect: can't check in named event name = %s err = %ld", fName, GetLastError()); + if ((fEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, fName)) == NULL) { + jack_error("Connect: can't check in named event name = %s err = %ld", fName, GetLastError()); return false; } else { return true; @@ -115,7 +119,6 @@ bool JackWinEvent::Disconnect() { if (fEvent) { JackLog("JackWinEvent::Disconnect %s\n", fName); - SetEvent(fEvent); // to "unlock" threads pending on the event CloseHandle(fEvent); fEvent = NULL; return true;