void CThread::Sleep(unsigned int milliseconds) { if(milliseconds > 10 && IsCurrentThread()) m_StopEvent.WaitMSec(milliseconds); else XbmcThreads::ThreadSleep(milliseconds); }
void CThread::Sleep(unsigned int milliseconds) { if(milliseconds > 10 && IsCurrentThread()) ::WaitForSingleObject(m_StopEvent, milliseconds); else ::Sleep(milliseconds); }
void CThread::StopThread(bool bWait /*= true*/) { m_bStop = true; m_StopEvent.Set(); CSingleLock lock(m_CriticalSection); if (m_ThreadId && bWait && !IsCurrentThread(m_ThreadId)) { lock.Leave(); WaitForThreadExit(0xFFFFFFFF); } }
DWORD CThread::WaitForSingleObject(HANDLE hHandle, unsigned int milliseconds) { if(milliseconds > 10 && IsCurrentThread()) { HANDLE handles[2] = {hHandle, m_StopEvent}; DWORD result = ::WaitForMultipleObjects(2, handles, false, milliseconds); if(result == WAIT_TIMEOUT || result == WAIT_OBJECT_0) return result; if( milliseconds == INFINITE ) return WAIT_ABANDONED; else return WAIT_TIMEOUT; } else return ::WaitForSingleObject(hHandle, milliseconds); }
bool CacheIOThread::YieldInternal() { if (!IsCurrentThread()) { NS_WARNING("Trying to yield to priority events on non-cache2 I/O thread? " "You probably do something wrong."); return false; } if (mCurrentlyExecutingLevel == XPCOM_LEVEL) { // Doesn't make any sense, since this handler is the one // that would be executed as the next one. return false; } if (!EventsPending(mCurrentlyExecutingLevel)) return false; mRerunCurrentEvent = true; return true; }
bool BufferDecoder::OnDecodeThread() const { MOZ_ASSERT(mDecodeThread, "Forgot to call BeginDecoding?"); return IsCurrentThread(mDecodeThread); }
bool CThread::IsCurrentThread() const { return IsCurrentThread(ThreadId()); }
void AudioSink::AssertOnAudioThread() { MOZ_ASSERT(IsCurrentThread(mThread)); }