cscore: Add Shutdown() function

This allows ordered shutdown / destruction of sources and sinks prior to
global singleton destruction.
This commit is contained in:
Peter Johnson
2018-11-07 00:01:27 -08:00
parent 76f5d153fa
commit 193b0a222c
7 changed files with 36 additions and 2 deletions

View File

@@ -45,8 +45,17 @@ Instance::Instance() : telemetry(notifier), networkListener(logger, notifier) {
Instance::~Instance() {}
Instance& Instance::GetInstance() {
static Instance inst;
return inst;
static Instance* inst = new Instance;
return *inst;
}
void Instance::Shutdown() {
eventLoop.Stop();
m_sinks.FreeAll();
m_sources.FreeAll();
networkListener.Stop();
telemetry.Stop();
notifier.Stop();
}
void Instance::SetDefaultLogger() { logger.SetLogger(def_log_func); }