mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
cscore: Add Shutdown() function
This allows ordered shutdown / destruction of sources and sinks prior to global singleton destruction.
This commit is contained in:
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user