From 947856ca8e844cede5492fb1323e772066cd9360 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 8 Oct 2020 17:23:03 +0200 Subject: [PATCH] event/Loop: forward-declare class TimerEvent --- src/event/Loop.cxx | 8 ++++++++ src/event/Loop.hxx | 7 +++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/event/Loop.cxx b/src/event/Loop.cxx index 6ade45573..1ef30c080 100644 --- a/src/event/Loop.cxx +++ b/src/event/Loop.cxx @@ -18,6 +18,7 @@ */ #include "Loop.hxx" +#include "TimerEvent.hxx" #include "SocketMonitor.hxx" #include "IdleMonitor.hxx" #include "DeferEvent.hxx" @@ -29,6 +30,13 @@ #include #endif +constexpr bool +EventLoop::TimerCompare::operator()(const TimerEvent &a, + const TimerEvent &b) const noexcept +{ + return a.due < b.due; +} + EventLoop::EventLoop(ThreadId _thread) :SocketMonitor(*this), /* if this instance is hosted by an EventThread (no ThreadId diff --git a/src/event/Loop.hxx b/src/event/Loop.hxx index f5cb1b608..865aa8cbc 100644 --- a/src/event/Loop.hxx +++ b/src/event/Loop.hxx @@ -27,7 +27,6 @@ #include "thread/Mutex.hxx" #include "WakeFD.hxx" #include "SocketMonitor.hxx" -#include "TimerEvent.hxx" #include "IdleMonitor.hxx" #include "DeferEvent.hxx" @@ -44,6 +43,8 @@ namespace Uring { class Queue; class Manager; } #endif +class TimerEvent; + /** * An event loop that polls for events on file/socket descriptors. * @@ -59,9 +60,7 @@ class EventLoop final : SocketMonitor struct TimerCompare { constexpr bool operator()(const TimerEvent &a, - const TimerEvent &b) const { - return a.due < b.due; - } + const TimerEvent &b) const noexcept; }; using TimerSet =