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;