mirror of https://github.com/Icinga/icinga2.git
parent
442d55c8da
commit
02c559eff9
|
@ -422,10 +422,6 @@ int Main(void)
|
||||||
rc = command->Run(vm, args);
|
rc = command->Run(vm, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _DEBUG
|
|
||||||
Application::Exit(rc);
|
|
||||||
#endif /* _DEBUG */
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,6 +577,8 @@ VOID WINAPI ServiceMain(DWORD argc, LPSTR *argv)
|
||||||
int rc = Main();
|
int rc = Main();
|
||||||
|
|
||||||
ReportSvcStatus(SERVICE_STOPPED, NO_ERROR, rc);
|
ReportSvcStatus(SERVICE_STOPPED, NO_ERROR, rc);
|
||||||
|
|
||||||
|
Application::Exit(rc);
|
||||||
}
|
}
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
|
|
@ -109,11 +109,19 @@ void Application::Exit(int rc)
|
||||||
logger->Flush();
|
logger->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UninitializeBase();
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
exit(rc);
|
||||||
|
#else /* _DEBUG */
|
||||||
_exit(rc); // Yay, our static destructors are pretty much beyond repair at this point.
|
_exit(rc); // Yay, our static destructors are pretty much beyond repair at this point.
|
||||||
|
#endif /* _DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::InitializeBase(void)
|
void Application::InitializeBase(void)
|
||||||
{
|
{
|
||||||
|
Timer::Initialize();
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
rlimit rl;
|
rlimit rl;
|
||||||
if (getrlimit(RLIMIT_NOFILE, &rl) >= 0) {
|
if (getrlimit(RLIMIT_NOFILE, &rl) >= 0) {
|
||||||
|
@ -146,6 +154,11 @@ void Application::InitializeBase(void)
|
||||||
Utility::ExecuteDeferredInitializers();
|
Utility::ExecuteDeferredInitializers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::UninitializeBase(void)
|
||||||
|
{
|
||||||
|
Timer::Uninitialize();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a pointer to the application singleton object.
|
* Retrieves a pointer to the application singleton object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
~Application(void);
|
~Application(void);
|
||||||
|
|
||||||
static void InitializeBase(void);
|
static void InitializeBase(void);
|
||||||
|
static void UninitializeBase(void);
|
||||||
|
|
||||||
static Application::Ptr GetInstance(void);
|
static Application::Ptr GetInstance(void);
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,9 @@ void Timer::Stop(void)
|
||||||
{
|
{
|
||||||
ASSERT(!OwnsLock());
|
ASSERT(!OwnsLock());
|
||||||
|
|
||||||
|
if (l_StopThread)
|
||||||
|
return;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(l_Mutex);
|
boost::mutex::scoped_lock lock(l_Mutex);
|
||||||
|
|
||||||
m_Started = false;
|
m_Started = false;
|
||||||
|
|
|
@ -25,20 +25,7 @@
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
struct TimerFixture
|
BOOST_AUTO_TEST_SUITE(base_timer)
|
||||||
{
|
|
||||||
TimerFixture(void)
|
|
||||||
{
|
|
||||||
Timer::Initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
~TimerFixture(void)
|
|
||||||
{
|
|
||||||
Timer::Uninitialize();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_SUITE(base_timer, TimerFixture)
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(construct)
|
BOOST_AUTO_TEST_CASE(construct)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,11 @@ struct InitLibBase
|
||||||
{
|
{
|
||||||
Application::InitializeBase();
|
Application::InitializeBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~InitLibBase(void)
|
||||||
|
{
|
||||||
|
Application::UninitializeBase();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOST_GLOBAL_FIXTURE(InitLibBase);
|
BOOST_GLOBAL_FIXTURE(InitLibBase);
|
||||||
|
|
Loading…
Reference in New Issue