event: make FineTimerEvent optional
Several applications don't need it, so let's eliminate the code from the executable.
This commit is contained in:
parent
a750e4afa7
commit
74976d3199
@ -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);
|
||||
|
@ -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<DeferEvent>;
|
||||
|
||||
@ -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().
|
||||
|
Loading…
Reference in New Issue
Block a user