Example #1
0
bool APISocket::CClientSocket::StopRoutine(unsigned long dwWaitTimeout)
{
	if (!m_hRoutineThread)
		return true;

	bool termResult = ShutdownThread(m_hRoutineThread, dwWaitTimeout, &routineShouldQuit, &routineHasQuit);
	m_hRoutineThread=0;
	m_dwRoutineThread=0;
	return termResult;
}
InputHandler_DInput::~InputHandler_DInput()
{
	ShutdownThread();

	for( unsigned i = 0; i < Devices.size(); ++i )
		Devices[i].Close();

	Devices.clear();
	IDirectInput_Release(dinput);
	dinput = NULL;
}
Example #3
0
bool APISocket::CSocket::StopAsync()
{
	if (!m_hAsyncThread)
		return true;

	shouldAsyncQuit = true;
	m_csAsync.Lock();
	m_csAsync.Unlock();
	bool stopResult = ShutdownThread(m_hAsyncThread, THREAD_STOP_TIMEOUT, &shouldAsyncQuit, &hasAsyncQuit);
	m_hAsyncThread = 0;
	m_dwAsyncThread = 0;
	return stopResult;
}
NS_IMETHODIMP
LazyIdleThread::Shutdown()
{
  ASSERT_OWNING_THREAD();

  mShutdown = true;

  nsresult rv = ShutdownThread();
  MOZ_ASSERT(!mThread, "Should have destroyed this by now!");

  mIdleObserver = nullptr;

  NS_ENSURE_SUCCESS(rv, rv);

  return NS_OK;
}
Example #5
0
NS_IMETHODIMP
LazyIdleThread::Shutdown()
{
    ASSERT_OWNING_THREAD();

    mShutdown = true;

    nsresult rv = ShutdownThread();
    MOZ_ASSERT(!mThread, "Should have destroyed this by now!");

    mIdleObserver = nullptr;

    if (NS_WARN_IF(NS_FAILED(rv)))
        return rv;

    return NS_OK;
}
NS_IMETHODIMP
LazyIdleThread::Notify(nsITimer* aTimer)
{
  ASSERT_OWNING_THREAD();

  {
    MutexAutoLock lock(mMutex);

    if (mPendingEventCount || mIdleNotificationCount) {
      // Another event was scheduled since this timer was set. Don't do
      // anything and wait for the timer to fire again.
      return NS_OK;
    }
  }

  nsresult rv = ShutdownThread();
  NS_ENSURE_SUCCESS(rv, rv);

  return NS_OK;
}
void InputHandler_DInput::WindowReset()
{
	/* We need to reopen keyboards. */
	ShutdownThread();

	for( unsigned i = 0; i < Devices.size(); ++i )
	{
		if( Devices[i].type != Devices[i].KEYBOARD )
			continue;

		Devices[i].Close();

		/* We lose buffered inputs here, so we need to clear all pressed keys. */
		INPUTFILTER->ResetDevice( Devices[i].dev );

		bool ret = Devices[i].Open();

		/* Reopening it should succeed. */
		ASSERT( ret );
	}

	StartThread();
}
Example #8
0
CProxiesManager::~CProxiesManager(void)
{
	ShutdownThread(m_hReconectProxiesThread, THREAD_STOP_TIMEOUT, &shouldQuit, &hasQuit);
	RemoveAllProxies();
}