event/TimerEvent: use base_hook instead of member_hook
This commit is contained in:
parent
4cd0f661d6
commit
cd9ff9d9b0
@ -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;
|
|||||||
* 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:
|
|||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user