Instance: add method Shutdown()

This commit is contained in:
Max Kellermann 2016-03-05 18:33:27 +01:00
parent 8e563cbccd
commit 23ab4e5e5f
3 changed files with 16 additions and 1 deletions

View File

@ -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)

View File

@ -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

View File

@ -393,7 +393,7 @@ idle_event_emitted(void)
static void
shutdown_event_emitted(void)
{
instance->event_loop->Break();
instance->Shutdown();
}
#endif