Browse Source

Correct Disconnect

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1298 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.59
sletz 19 years ago
parent
commit
27a8674882
1 changed files with 19 additions and 16 deletions
  1. +19
    -16
      windows/JackWinEvent.cpp

+ 19
- 16
windows/JackWinEvent.cpp View File

@@ -37,12 +37,13 @@ bool JackWinEvent::Signal()
assert(fEvent); assert(fEvent);


if (fFlush) if (fFlush)
return true;
return true;
if (!(res = SetEvent(fEvent))) { if (!(res = SetEvent(fEvent))) {
jack_error("JackWinEvent::Signal name = %s err = %ld", fName, GetLastError()); jack_error("JackWinEvent::Signal name = %s err = %ld", fName, GetLastError());
}
return res;
}
return res;
} }


bool JackWinEvent::SignalAll() bool JackWinEvent::SignalAll()
@@ -51,12 +52,13 @@ bool JackWinEvent::SignalAll()
assert(fEvent); assert(fEvent);


if (fFlush) if (fFlush)
return true;
return true;
if (!(res = SetEvent(fEvent))) { if (!(res = SetEvent(fEvent))) {
jack_error("JackWinEvent::SignalAll name = %s err = %ld", fName, GetLastError()); jack_error("JackWinEvent::SignalAll name = %s err = %ld", fName, GetLastError());
}
return res;
}
return res;
} }


bool JackWinEvent::Wait() bool JackWinEvent::Wait()
@@ -64,7 +66,8 @@ bool JackWinEvent::Wait()
DWORD res; DWORD res;


if ((res = WaitForSingleObject(fEvent, INFINITE)) != WAIT_OBJECT_0) { 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); return (res == WAIT_OBJECT_0);
@@ -72,11 +75,12 @@ bool JackWinEvent::Wait()


bool JackWinEvent::TimedWait(long usec) 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); return (res == WAIT_OBJECT_0);
} }
@@ -93,8 +97,8 @@ bool JackWinEvent::ConnectInput(const char* name)
return true; 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; return false;
} else { } else {
return true; return true;
@@ -115,7 +119,6 @@ bool JackWinEvent::Disconnect()
{ {
if (fEvent) { if (fEvent) {
JackLog("JackWinEvent::Disconnect %s\n", fName); JackLog("JackWinEvent::Disconnect %s\n", fName);
SetEvent(fEvent); // to "unlock" threads pending on the event
CloseHandle(fEvent); CloseHandle(fEvent);
fEvent = NULL; fEvent = NULL;
return true; return true;


Loading…
Cancel
Save