diff options
Diffstat (limited to '')
-rw-r--r-- | src/Root.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/Root.cpp b/src/Root.cpp index 924ebcc1a..c8a268a78 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -68,24 +68,24 @@ cRoot::~cRoot() -void cRoot::InputThread(cRoot * a_Params) +void cRoot::InputThread(cRoot & a_Params) { cLogCommandOutputCallback Output; - while (!a_Params->m_bStop && !a_Params->m_bRestart && !m_TerminateEventRaised && std::cin.good()) + while (!a_Params.m_bStop && !a_Params.m_bRestart && !m_TerminateEventRaised && std::cin.good()) { AString Command; std::getline(std::cin, Command); if (!Command.empty()) { - a_Params->ExecuteConsoleCommand(TrimString(Command), Output); + a_Params.ExecuteConsoleCommand(TrimString(Command), Output); } } if (m_TerminateEventRaised || !std::cin.good()) { // We have come here because the std::cin has received an EOF / a terminate signal has been sent, and the server is still running; stop the server: - a_Params->m_bStop = true; + a_Params.m_bStop = true; } } @@ -191,7 +191,8 @@ void cRoot::Start(void) LOGD("Starting InputThread..."); try { - m_InputThread = std::thread(InputThread, this); + m_InputThread = std::thread(InputThread, std::ref(*this)); + m_InputThread.detach(); } catch (std::system_error & a_Exception) { @@ -217,17 +218,6 @@ void cRoot::Start(void) m_bStop = true; } - #if !defined(ANDROID_NDK) - try - { - m_InputThread.join(); - } - catch (std::system_error & a_Exception) - { - LOGERROR("ERROR: Could not wait for input thread to finish, error = %s!", a_Exception.code(), a_Exception.what()); - } - #endif - // Stop the server: m_WebAdmin->Stop(); LOG("Shutting down server..."); |