diff options
author | peterbell10 <peterbell10@live.co.uk> | 2020-10-05 12:27:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 12:27:14 +0200 |
commit | a9031b6bae742b333b1b390192fa590f2ecb07ea (patch) | |
tree | b2802c81d24d339c201a0747d66ba44e9ea8b1b0 /src/Root.cpp | |
parent | Fixed current end generator (#4968) (diff) | |
download | cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.gz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.bz2 cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.lz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.xz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.zst cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Root.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/Root.cpp b/src/Root.cpp index 0decfd4dd..49adf3f6c 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -45,10 +45,8 @@ -extern bool g_RunAsService; -decltype(cRoot::s_Root) cRoot::s_Root; -decltype(cRoot::s_NextState) cRoot::s_NextState; -decltype(cRoot::s_StopEvent) cRoot::s_StopEvent; +extern bool g_RunAsService; +cRoot * cRoot::s_Root = nullptr; @@ -194,7 +192,7 @@ bool cRoot::Run(cSettingsRepositoryInterface & a_OverridesRepo) m_StartTime = std::chrono::steady_clock::now(); HandleInput(); - s_StopEvent.Wait(); + m_StopEvent.Wait(); // Stop the server: m_WebAdmin->Stop(); @@ -233,7 +231,7 @@ bool cRoot::Run(cSettingsRepositoryInterface & a_OverridesRepo) LOG("Shutdown successful!"); LOG("--- Stopped Log ---"); - return s_NextState == NextState::Restart; + return m_NextState == NextState::Restart; } @@ -957,7 +955,7 @@ void cRoot::HandleInput() cLogCommandOutputCallback Output; AString Command; - while (s_NextState == NextState::Run) + while (m_NextState == NextState::Run) { #ifndef _WIN32 timeval Timeout{ 0, 0 }; @@ -980,7 +978,7 @@ void cRoot::HandleInput() return; } - if (s_NextState != NextState::Run) + if (m_NextState != NextState::Run) { // Already shutting down, can't execute commands break; @@ -1001,7 +999,7 @@ void cRoot::HandleInput() void cRoot::TransitionNextState(NextState a_NextState) { { - auto Current = s_NextState.load(); + auto Current = m_NextState.load(); do { // Stopping is final, so stops override restarts: @@ -1010,15 +1008,15 @@ void cRoot::TransitionNextState(NextState a_NextState) return; } } - while (!s_NextState.compare_exchange_strong(Current, a_NextState)); + while (!m_NextState.compare_exchange_strong(Current, a_NextState)); } - if (s_NextState == NextState::Run) + if (m_NextState == NextState::Run) { return; } - s_StopEvent.Set(); + m_StopEvent.Set(); #ifdef WIN32 |