rc = command->Run(vm, args);
}
-#ifndef _DEBUG
- Application::Exit(rc);
-#endif /* _DEBUG */
-
return rc;
}
int rc = Main();
ReportSvcStatus(SERVICE_STOPPED, NO_ERROR, rc);
+
+ Application::Exit(rc);
}
#endif /* _WIN32 */
logger->Flush();
}
+ UninitializeBase();
+
+#ifdef _DEBUG
+ exit(rc);
+#else /* _DEBUG */
_exit(rc); // Yay, our static destructors are pretty much beyond repair at this point.
+#endif /* _DEBUG */
}
void Application::InitializeBase(void)
{
+ Timer::Initialize();
+
#ifndef _WIN32
rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) >= 0) {
Utility::ExecuteDeferredInitializers();
}
+void Application::UninitializeBase(void)
+{
+ Timer::Uninitialize();
+}
+
/**
* Retrieves a pointer to the application singleton object.
*
~Application(void);
static void InitializeBase(void);
+ static void UninitializeBase(void);
static Application::Ptr GetInstance(void);
{
ASSERT(!OwnsLock());
+ if (l_StopThread)
+ return;
+
boost::mutex::scoped_lock lock(l_Mutex);
m_Started = false;
using namespace icinga;
-struct TimerFixture
-{
- TimerFixture(void)
- {
- Timer::Initialize();
- }
-
- ~TimerFixture(void)
- {
- Timer::Uninitialize();
- }
-};
-
-BOOST_FIXTURE_TEST_SUITE(base_timer, TimerFixture)
+BOOST_AUTO_TEST_SUITE(base_timer)
BOOST_AUTO_TEST_CASE(construct)
{
{
Application::InitializeBase();
}
+
+ ~InitLibBase(void)
+ {
+ Application::UninitializeBase();
+ }
};
BOOST_GLOBAL_FIXTURE(InitLibBase);