22 #ifndef NDN_UTIL_SCHEDULER_HPP 23 #define NDN_UTIL_SCHEDULER_HPP 29 #include <boost/system/error_code.hpp> 78 operator bool()
const noexcept;
102 weak_ptr<EventInfo> m_info;
130 using ScopedCancelHandle::ScopedCancelHandle;
147 operator()(
const shared_ptr<EventInfo>& a,
const shared_ptr<EventInfo>& b)
const noexcept;
158 Scheduler(boost::asio::io_service& ioService);
166 scheduleEvent(time::nanoseconds after,
const EventCallback& callback);
185 cancelImpl(
const shared_ptr<EventInfo>& info);
198 executeEvent(
const boost::system::error_code& code);
201 unique_ptr<detail::SteadyTimer> m_timer;
203 bool m_isEventExecuting;
220 #endif // NDN_UTIL_SCHEDULER_HPP bool operator!=(const EventId &other) const noexcept
std::ostream & operator<<(std::ostream &os, LoggerTimestamp)
Write a timestamp to os.
EventId(std::nullptr_t) noexcept
Allow implicit conversion from nullptr.
std::function< void()> EventCallback
Function to be invoked when a scheduled event expires.
std::multiset< shared_ptr< EventInfo >, EventQueueCompare > EventQueue
A scoped handle of scheduled event.
Handle to cancel an operation.
bool operator==(const Data &lhs, const Data &rhs)
void cancelEvent(const EventId &eid)
Cancel a scheduled event.
void cancel() const
Cancel the operation.
A handle of scheduled event.
ScopedEventId(Scheduler &scheduler) noexcept
Cancels an operation automatically upon destruction.