event/TimerList: remove option NO_BOOST
Always use the new IntrusiveTreeSet class.
This commit is contained in:
parent
c5e607a310
commit
1ee25b4234
@ -7,12 +7,7 @@
|
||||
#include "Chrono.hxx"
|
||||
#include "event/Features.h"
|
||||
#include "util/BindMethod.hxx"
|
||||
|
||||
#ifdef NO_BOOST
|
||||
#include "util/IntrusiveList.hxx"
|
||||
#else
|
||||
#include "util/IntrusiveTreeSet.hxx"
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@ -30,16 +25,9 @@ class EventLoop;
|
||||
* as thread-safe.
|
||||
*/
|
||||
class FineTimerEvent final :
|
||||
#ifdef NO_BOOST
|
||||
AutoUnlinkIntrusiveListHook
|
||||
#else
|
||||
public IntrusiveTreeSetHook<IntrusiveHookMode::AUTO_UNLINK>
|
||||
#endif
|
||||
{
|
||||
friend class TimerList;
|
||||
#ifdef NO_BOOST
|
||||
friend struct IntrusiveListBaseHookTraits<FineTimerEvent>;
|
||||
#endif
|
||||
|
||||
EventLoop &loop;
|
||||
|
||||
@ -105,9 +93,7 @@ public:
|
||||
void ScheduleEarlier(Event::Duration d) noexcept;
|
||||
|
||||
void Cancel() noexcept {
|
||||
#ifdef NO_BOOST
|
||||
if (IsPending())
|
||||
#endif
|
||||
unlink();
|
||||
}
|
||||
|
||||
|
@ -11,17 +11,6 @@ TimerList::GetDue::operator()(const FineTimerEvent &timer) const noexcept
|
||||
return timer.due;
|
||||
}
|
||||
|
||||
#ifdef NO_BOOST
|
||||
|
||||
constexpr bool
|
||||
TimerList::Compare::operator()(const FineTimerEvent &a,
|
||||
const FineTimerEvent &b) const noexcept
|
||||
{
|
||||
return a.due < b.due;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
TimerList::TimerList() = default;
|
||||
|
||||
TimerList::~TimerList() noexcept
|
||||
@ -48,11 +37,7 @@ TimerList::Run(const Event::TimePoint now) noexcept
|
||||
if (timeout > timeout.zero())
|
||||
return timeout;
|
||||
|
||||
#ifdef NO_BOOST
|
||||
t.Cancel();
|
||||
#else
|
||||
timers.pop_front();
|
||||
#endif
|
||||
|
||||
t.Run();
|
||||
}
|
||||
|
@ -6,12 +6,7 @@
|
||||
|
||||
#include "Chrono.hxx"
|
||||
#include "event/Features.h"
|
||||
|
||||
#ifdef NO_BOOST
|
||||
#include "util/IntrusiveSortedList.hxx"
|
||||
#else
|
||||
#include "util/IntrusiveTreeSet.hxx"
|
||||
#endif
|
||||
|
||||
class FineTimerEvent;
|
||||
|
||||
@ -23,20 +18,8 @@ class TimerList final {
|
||||
constexpr Event::TimePoint operator()(const FineTimerEvent &timer) const noexcept;
|
||||
};
|
||||
|
||||
#ifdef NO_BOOST
|
||||
struct Compare {
|
||||
constexpr bool operator()(const FineTimerEvent &a,
|
||||
const FineTimerEvent &b) const noexcept;
|
||||
};
|
||||
|
||||
/* when building without Boost, then this is just a sorted
|
||||
doubly-linked list - this doesn't scale well, but is good
|
||||
enough for most programs */
|
||||
IntrusiveSortedList<FineTimerEvent, Compare> timers;
|
||||
#else
|
||||
IntrusiveTreeSet<FineTimerEvent,
|
||||
IntrusiveTreeSetOperators<FineTimerEvent, GetDue>> timers;
|
||||
#endif
|
||||
|
||||
public:
|
||||
TimerList();
|
||||
|
@ -3,7 +3,6 @@ event_features.set('USE_EVENTFD', is_linux and get_option('eventfd'))
|
||||
event_features.set('USE_SIGNALFD', is_linux and get_option('signalfd'))
|
||||
event_features.set('USE_EPOLL', is_linux and get_option('epoll'))
|
||||
event_features.set('HAVE_THREADED_EVENT_LOOP', true)
|
||||
event_features.set('NO_BOOST', true)
|
||||
configure_file(output: 'Features.h', configuration: event_features)
|
||||
|
||||
event_sources = []
|
||||
|
Loading…
Reference in New Issue
Block a user