bool SFB::Audio::Output::RequestStop() { LOGGER_DEBUG("org.sbooth.AudioEngine.Output", "Requesting output stop"); if(!_IsOpen()) return false; if(!_IsRunning()) return true; return _RequestStop(); }
bool SFB::Audio::Output::Stop() { LOGGER_DEBUG("org.sbooth.AudioEngine.Output", "Stopping output"); if(!_IsOpen()) return false; if(!_IsRunning()) return true; return _Stop(); }
bool CProcess::Wait (unsigned long lTimeout) { #ifdef _WIN32 switch (WaitForSingleObject (m_process, lTimeout)) { case WAIT_ABANDONED : SetLastError (ERROR_ABANDONED_WAIT_0); return false; case WAIT_OBJECT_0 : return true; case WAIT_TIMEOUT : SetLastError (ETIMEDOUT); return false; default : return false; } #else #define POLL_TIMEOUT 1000 unsigned long n; for (n = 0; _IsRunning (m_process) && (n < lTimeout / POLL_TIMEOUT); n++) { CThread::Sleep (POLL_TIMEOUT); } return !_IsRunning (m_process); #endif }
bool CProcess::IsAlive () { #ifdef _WIN32 DWORD dwExitCode; if (!GetExitCodeProcess (m_process, &dwExitCode)) { LOGWARN (TEXT ("Couldn't query exit code of JVM process, error ") << GetLastError ()); return false; } if (dwExitCode == STILL_ACTIVE) { return true; } else { LOGWARN (TEXT ("Process has terminated, exit code ") << dwExitCode); return false; } #else /* ifdef _WIN32 */ return _IsRunning (m_process); #endif /* ifdef _WIN32 */ }