示例#1
0
文件: Thread.cpp 项目: 0xheart0/xbmc
void CThread::Sleep(unsigned int milliseconds)
{
  if(milliseconds > 10 && IsCurrentThread())
    m_StopEvent.WaitMSec(milliseconds);
  else
    XbmcThreads::ThreadSleep(milliseconds);
}
示例#2
0
文件: Thread.cpp 项目: mmrvka/xbmc
void CThread::Sleep(unsigned int milliseconds)
{
  if(milliseconds > 10 && IsCurrentThread())
    ::WaitForSingleObject(m_StopEvent, milliseconds);
  else
    ::Sleep(milliseconds);
}
示例#3
0
文件: Thread.cpp 项目: ssfdre38/xbmc
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);
  }
}
示例#4
0
文件: Thread.cpp 项目: mmrvka/xbmc
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);
}
示例#5
0
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);
}
示例#7
0
文件: Thread.cpp 项目: mmrvka/xbmc
bool CThread::IsCurrentThread() const
{
  return IsCurrentThread(ThreadId());
}
示例#8
0
void
AudioSink::AssertOnAudioThread()
{
  MOZ_ASSERT(IsCurrentThread(mThread));
}