Commit 23ab4e5e authored by Max Kellermann's avatar Max Kellermann

Instance: add method Shutdown()

parent 8e563cbc
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "Partition.hxx" #include "Partition.hxx"
#include "Idle.hxx" #include "Idle.hxx"
#include "Stats.hxx" #include "Stats.hxx"
#include "event/Loop.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
...@@ -32,6 +33,15 @@ ...@@ -32,6 +33,15 @@
#include "sticker/StickerDatabase.hxx" #include "sticker/StickerDatabase.hxx"
#include "sticker/SongSticker.hxx" #include "sticker/SongSticker.hxx"
#endif #endif
#endif
void
Instance::Shutdown()
{
event_loop->Break();
}
#ifdef ENABLE_DATABASE
Database * Database *
Instance::GetDatabase(Error &error) Instance::GetDatabase(Error &error)
......
...@@ -76,6 +76,11 @@ struct Instance final ...@@ -76,6 +76,11 @@ struct Instance final
Partition *partition; Partition *partition;
/**
* Initiate shutdown. Wrapper for EventLoop::Break().
*/
void Shutdown();
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
/** /**
* Returns the global #Database instance. May return nullptr * Returns the global #Database instance. May return nullptr
......
...@@ -393,7 +393,7 @@ idle_event_emitted(void) ...@@ -393,7 +393,7 @@ idle_event_emitted(void)
static void static void
shutdown_event_emitted(void) shutdown_event_emitted(void)
{ {
instance->event_loop->Break(); instance->Shutdown();
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment