void JoystickController::start(bool isThreaded) { if(isThreaded) mainThread = new boost::thread(boost::bind(&JoystickController::startHelper,this)); else startHelper(); }
void ToolIPCPipeClient::start() { startHelper(); size_t x=0; do { try { tryStart(); break; } catch (gcException) { if (x > 5) { throw; } else { gcSleep(500); x++; } } } while (true); }
void OverlayPrivateWin::setActive(bool active) { if (m_active != active) { m_active = active; if (m_active) { if (m_helper_enabled) { startHelper(m_helper_process); } if (m_helper64_enabled) { startHelper(m_helper64_process); } } else { if (m_helper_enabled) { m_helper_process->terminate(); } if (m_helper64_enabled) { m_helper64_process->terminate(); } } } }
void OverlayPrivateWin::onHelperProcessExited(int exitCode, QProcess::ExitStatus exitStatus) { QProcess *helper = qobject_cast<QProcess *>(sender()); QString path; qint64 elapsedMsec = 0; QTimer *restartTimer = NULL; if (helper == m_helper_process) { path = m_helper_exe_path; elapsedMsec = m_helper_start_time.elapsed(); restartTimer = m_helper_restart_timer; } else if (helper == m_helper64_process) { path = m_helper64_exe_path; elapsedMsec = m_helper64_start_time.elapsed(); restartTimer = m_helper64_restart_timer; } else { qFatal("OverlayPrivateWin: unknown QProcess found in onHelperProcessExited()."); } const char *helperErrString = OverlayHelperErrorToString(static_cast<OverlayHelperError>(exitCode)); qWarning("OverlayPrivateWin: overlay helper process '%s' exited (%s) with status code %s.", qPrintable(path), exitStatusString(exitStatus), helperErrString ? helperErrString : qPrintable(QString::number(exitCode))); // If the helper process exited while we're in 'active' // mode, restart it. if (m_active) { // If the helper was only recently started, be // a little more patient with restarting it. // We could be hitting a crash bug in the helper, // and we don't want to do too much harm in that // case by spawning thousands of processes. qint64 cooldownMsec = (qint64) g.s.iOverlayWinHelperRestartCooldownMsec; if (elapsedMsec < cooldownMsec) { qint64 delayMsec = cooldownMsec - elapsedMsec; qWarning("OverlayPrivateWin: waiting %llu seconds until restarting helper process '%s'. last restart was %llu seconds ago.", (unsigned long long) delayMsec/1000ULL, qPrintable(path), (unsigned long long) elapsedMsec/1000ULL); if (!restartTimer->isActive()) { restartTimer->start(delayMsec); } } else { startHelper(helper); } } }
void OverlayPrivateWin::onDelayedRestartTimerTriggered() { if (!m_active) { return; } QTimer *timer = qobject_cast<QTimer *>(sender()); QProcess *helper = NULL; if (timer == m_helper_restart_timer) { helper = m_helper_process; } else if (timer == m_helper64_restart_timer) { helper = m_helper64_process; } else { qFatal("OverlayPrivateWin: unknown timer found in onDelayedRestartTimerTriggered()."); } if (helper->state() == QProcess::NotRunning) { startHelper(helper); } }