diff --git a/src/Instance.cxx b/src/Instance.cxx index 7782e9b9d..f65eca42d 100644 --- a/src/Instance.cxx +++ b/src/Instance.cxx @@ -22,6 +22,7 @@ #include "Partition.hxx" #include "Idle.hxx" #include "Stats.hxx" +#include "event/Loop.hxx" #include "util/Error.hxx" #ifdef ENABLE_DATABASE @@ -32,6 +33,15 @@ #include "sticker/StickerDatabase.hxx" #include "sticker/SongSticker.hxx" #endif +#endif + +void +Instance::Shutdown() +{ + event_loop->Break(); +} + +#ifdef ENABLE_DATABASE Database * Instance::GetDatabase(Error &error) diff --git a/src/Instance.hxx b/src/Instance.hxx index 57687ec1a..11de979a7 100644 --- a/src/Instance.hxx +++ b/src/Instance.hxx @@ -76,6 +76,11 @@ struct Instance final Partition *partition; + /** + * Initiate shutdown. Wrapper for EventLoop::Break(). + */ + void Shutdown(); + #ifdef ENABLE_DATABASE /** * Returns the global #Database instance. May return nullptr diff --git a/src/Main.cxx b/src/Main.cxx index f68ecf60d..6529c4fc4 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -393,7 +393,7 @@ idle_event_emitted(void) static void shutdown_event_emitted(void) { - instance->event_loop->Break(); + instance->Shutdown(); } #endif