コード例 #1
0
ファイル: WiimoteReal.cpp プロジェクト: djtedo/dolphin
void Wiimote::ThreadFunc()
{
	Common::SetCurrentThreadName("Wiimote Device Thread");

	bool ok = ConnectInternal();

	SetReady();

	if (!ok)
	{
		return;
	}

	// main loop
	while (IsConnected() && m_run_thread)
	{
		if (m_need_prepare)
		{
			m_need_prepare = false;
			if (!PrepareOnThread())
			{
				ERROR_LOG(WIIMOTE, "Wiimote::PrepareOnThread failed.  Disconnecting Wiimote %d.", index + 1);
				break;
			}
		}
		Write();
		Read();
	}

	DisconnectInternal();
}
コード例 #2
0
ファイル: WiimoteReal.cpp プロジェクト: FLyrfors/dolphin
void Wiimote::ThreadFunc()
{
  Common::SetCurrentThreadName("Wiimote Device Thread");

  bool ok = ConnectInternal();

  if (!ok)
  {
    // try again, it might take a moment to settle
    Common::SleepCurrentThread(100);
    ok = ConnectInternal();
  }

  SetReady();

  if (!ok)
  {
    return;
  }

  // main loop
  while (IsConnected() && m_run_thread.load())
  {
    if (m_need_prepare.load())
    {
      m_need_prepare.store(false);
      if (!PrepareOnThread())
      {
        ERROR_LOG(WIIMOTE, "Wiimote::PrepareOnThread failed.  Disconnecting Wiimote %d.",
                  m_index + 1);
        break;
      }
    }
    Write();
    Read();
  }

  DisconnectInternal();
}