From 07add0bd91b4f772f2895cd201edc615101a7fc3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 10 Mar 2016 20:32:35 +0100 Subject: [PATCH] Instance: add base class which owns the EventLoop --- src/Instance.hxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Instance.hxx b/src/Instance.hxx index 99b8cd8ab..d3e928750 100644 --- a/src/Instance.hxx +++ b/src/Instance.hxx @@ -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