Instance: add base class which owns the EventLoop

This commit is contained in:
Max Kellermann 2016-03-10 20:32:35 +01:00
parent 9a9b6fa326
commit 07add0bd91

View File

@ -42,9 +42,18 @@ class ClientList;
struct Partition;
class StateFile;
/**
* A utility class which, when used as the first base class, ensures
* that the #EventLoop gets initialized before the other base classes.
*/
struct EventLoopHolder {
EventLoop event_loop;
};
struct Instance final
: EventLoopHolder
#if defined(ENABLE_DATABASE) || defined(ENABLE_NEIGHBOR_PLUGINS)
:
,
#endif
#ifdef ENABLE_DATABASE
public DatabaseListener
@ -56,8 +65,6 @@ struct Instance final
public NeighborListener
#endif
{
EventLoop event_loop;
GlobalEvents::Monitor global_events;
#ifdef ENABLE_NEIGHBOR_PLUGINS