7 #ifndef NDN_UTIL_SCHEDULER_HPP
8 #define NDN_UTIL_SCHEDULER_HPP
10 #include "../common.hpp"
19 typedef shared_ptr<EventIdImpl>
EventId;
29 Scheduler(boost::asio::io_service& ioService);
45 const time::nanoseconds& period,
56 onEvent(
const boost::system::error_code& code);
61 EventInfo(
const time::nanoseconds& after,
62 const time::nanoseconds& period,
68 operator <=(
const EventInfo& other)
const
70 return this->m_scheduledTime <= other.m_scheduledTime;
74 operator <(
const EventInfo& other)
const
76 return this->m_scheduledTime < other.m_scheduledTime;
80 expiresFromNow()
const;
83 time::nanoseconds m_period;
88 typedef std::multiset<EventInfo> EventQueue;
92 EventQueue::iterator m_scheduledEvent;
95 bool m_isEventExecuting;
100 #endif // NDN_UTIL_SCHEDULER_HPP
EventId scheduleEvent(const time::nanoseconds &after, const Event &event)
Schedule one time event after the specified delay.
boost::asio::basic_deadline_timer< time::steady_clock::TimePoint::clock > monotonic_deadline_timer
shared_ptr< EventIdImpl > EventId
Private storage of information about the event.
void cancelEvent(const EventId &eventId)
Cancel scheduled event.
Scheduler(boost::asio::io_service &ioService)
EventId schedulePeriodicEvent(const time::nanoseconds &after, const time::nanoseconds &period, const Event &event)
Schedule periodic event that should be fired every specified period.