summaryrefslogtreecommitdiffstats
path: root/src/Root.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Root.cpp')
-rw-r--r--src/Root.cpp22
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