Commit cd9ff9d9 authored by Max Kellermann's avatar Max Kellermann

event/TimerEvent: use base_hook instead of member_hook

parent 4cd0f661
...@@ -66,9 +66,7 @@ class EventLoop final : SocketMonitor ...@@ -66,9 +66,7 @@ class EventLoop final : SocketMonitor
using TimerSet = using TimerSet =
boost::intrusive::multiset<TimerEvent, boost::intrusive::multiset<TimerEvent,
boost::intrusive::member_hook<TimerEvent, boost::intrusive::base_hook<boost::intrusive::set_base_hook<>>,
TimerEvent::TimerSetHook,
&TimerEvent::timer_set_hook>,
boost::intrusive::compare<TimerCompare>, boost::intrusive::compare<TimerCompare>,
boost::intrusive::constant_time_size<false>>; boost::intrusive::constant_time_size<false>>;
TimerSet timers; TimerSet timers;
......
...@@ -36,12 +36,11 @@ class EventLoop; ...@@ -36,12 +36,11 @@ class EventLoop;
* thread that runs the #EventLoop, except where explicitly documented * thread that runs the #EventLoop, except where explicitly documented
* as thread-safe. * as thread-safe.
*/ */
class TimerEvent final { class TimerEvent final
: public boost::intrusive::set_base_hook<>
{
friend class EventLoop; friend class EventLoop;
typedef boost::intrusive::set_member_hook<> TimerSetHook;
TimerSetHook timer_set_hook;
EventLoop &loop; EventLoop &loop;
typedef BoundMethod<void() noexcept> Callback; typedef BoundMethod<void() noexcept> Callback;
...@@ -67,7 +66,7 @@ public: ...@@ -67,7 +66,7 @@ public:
} }
bool IsActive() const noexcept { bool IsActive() const noexcept {
return timer_set_hook.is_linked(); return is_linked();
} }
void Schedule(std::chrono::steady_clock::duration d) noexcept; void Schedule(std::chrono::steady_clock::duration d) noexcept;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment