diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-10-19 15:10:18 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-10-19 15:10:18 +0200 |
commit | aa19a3afb0b94e8b5fe055eeb38b1fb2ee1a67b0 (patch) | |
tree | f9b31400ccb64fb6c30af41952ba854cf246ff54 /src/Root.cpp | |
parent | Merge branch 'master' of https://github.com/mc-server/MCServer (diff) | |
download | cuberite-aa19a3afb0b94e8b5fe055eeb38b1fb2ee1a67b0.tar cuberite-aa19a3afb0b94e8b5fe055eeb38b1fb2ee1a67b0.tar.gz cuberite-aa19a3afb0b94e8b5fe055eeb38b1fb2ee1a67b0.tar.bz2 cuberite-aa19a3afb0b94e8b5fe055eeb38b1fb2ee1a67b0.tar.lz cuberite-aa19a3afb0b94e8b5fe055eeb38b1fb2ee1a67b0.tar.xz cuberite-aa19a3afb0b94e8b5fe055eeb38b1fb2ee1a67b0.tar.zst cuberite-aa19a3afb0b94e8b5fe055eeb38b1fb2ee1a67b0.zip |
Diffstat (limited to 'src/Root.cpp')
-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..."); |