diff --git a/src/event/DeferEvent.hxx b/src/event/DeferEvent.hxx index ca88ef619..b96c2fbac 100644 --- a/src/event/DeferEvent.hxx +++ b/src/event/DeferEvent.hxx @@ -31,12 +31,11 @@ class EventLoop; * * This class is thread-safe. */ -class DeferEvent final { +class DeferEvent final + : public boost::intrusive::list_base_hook<> +{ friend class EventLoop; - typedef boost::intrusive::list_member_hook<> ListHook; - ListHook list_hook; - EventLoop &loop; typedef BoundMethod Callback; @@ -59,7 +58,7 @@ public: private: bool IsPending() const noexcept { - return list_hook.is_linked(); + return is_linked(); } void RunDeferred() noexcept { diff --git a/src/event/IdleEvent.hxx b/src/event/IdleEvent.hxx index 2f207f23b..c43d6117a 100644 --- a/src/event/IdleEvent.hxx +++ b/src/event/IdleEvent.hxx @@ -34,12 +34,11 @@ class EventLoop; * thread that runs the #EventLoop, except where explicitly documented * as thread-safe. */ -class IdleEvent { +class IdleEvent + : public boost::intrusive::list_base_hook<> +{ friend class EventLoop; - using ListHook = boost::intrusive::list_member_hook<>; - ListHook list_hook; - EventLoop &loop; using Callback = BoundMethod; @@ -63,7 +62,7 @@ public: } bool IsActive() const noexcept { - return list_hook.is_linked(); + return is_linked(); } void Schedule() noexcept; diff --git a/src/event/Loop.hxx b/src/event/Loop.hxx index 0c83d4d52..c7e3baf8a 100644 --- a/src/event/Loop.hxx +++ b/src/event/Loop.hxx @@ -72,9 +72,7 @@ class EventLoop final : SocketMonitor using IdleList = boost::intrusive::list, + boost::intrusive::base_hook>, boost::intrusive::constant_time_size>; IdleList idle; @@ -82,9 +80,7 @@ class EventLoop final : SocketMonitor using DeferredList = boost::intrusive::list, + boost::intrusive::base_hook>, boost::intrusive::constant_time_size>; DeferredList deferred;