From 23ab4e5e5f232072323484aad347e2a8feff7ad1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 5 Mar 2016 18:33:27 +0100 Subject: [PATCH] Instance: add method Shutdown() --- src/Instance.cxx | 10 ++++++++++ src/Instance.hxx | 5 +++++ src/Main.cxx | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) 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