diff --git a/src/event/Loop.cxx b/src/event/Loop.cxx index 1f8845124..f64b82852 100644 --- a/src/event/Loop.cxx +++ b/src/event/Loop.cxx @@ -146,6 +146,8 @@ EventLoop::Insert(CoarseTimerEvent &t) noexcept again = true; } +#ifndef NO_FINE_TIMER_EVENT + void EventLoop::Insert(FineTimerEvent &t) noexcept { @@ -167,12 +169,18 @@ GetEarlierTimeout(Event::Duration a, Event::Duration b) noexcept : b; } +#endif // NO_FINE_TIMER_EVENT + inline Event::Duration EventLoop::HandleTimers() noexcept { const auto now = SteadyNow(); +#ifndef NO_FINE_TIMER_EVENT auto fine_timeout = timers.Run(now); +#else + const Event::Duration fine_timeout{-1}; +#endif // NO_FINE_TIMER_EVENT auto coarse_timeout = coarse_timers.Run(now); return GetEarlierTimeout(coarse_timeout, fine_timeout); diff --git a/src/event/Loop.hxx b/src/event/Loop.hxx index 7aad5ac78..9bd37db08 100644 --- a/src/event/Loop.hxx +++ b/src/event/Loop.hxx @@ -22,13 +22,16 @@ #include "Chrono.hxx" #include "TimerWheel.hxx" -#include "TimerList.hxx" #include "Backend.hxx" #include "SocketEvent.hxx" #include "event/Features.h" #include "time/ClockCache.hxx" #include "util/IntrusiveList.hxx" +#ifndef NO_FINE_TIMER_EVENT +#include "TimerList.hxx" +#endif // NO_FINE_TIMER_EVENT + #ifdef HAVE_THREADED_EVENT_LOOP #include "WakeFD.hxx" #include "thread/Id.hxx" @@ -64,7 +67,10 @@ class EventLoop final #endif TimerWheel coarse_timers; + +#ifndef NO_FINE_TIMER_EVENT TimerList timers; +#endif // NO_FINE_TIMER_EVENT using DeferList = IntrusiveList; @@ -226,7 +232,10 @@ public: bool AbandonFD(SocketEvent &event) noexcept; void Insert(CoarseTimerEvent &t) noexcept; + +#ifndef NO_FINE_TIMER_EVENT void Insert(FineTimerEvent &t) noexcept; +#endif // NO_FINE_TIMER_EVENT /** * Schedule a call to DeferEvent::RunDeferred().