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;
149 Scheduler(boost::asio::io_service& ioService);
161 [[
deprecated(
"use schedule(after, callback)")]]
165 return schedule(after,
std::move(callback));
184 cancelImpl(
const shared_ptr<EventInfo>& info);
197 executeEvent(
const boost::system::error_code& code);
200 class EventQueueCompare
204 operator()(
const shared_ptr<EventInfo>& a,
const shared_ptr<EventInfo>& b)
const noexcept;
207 using EventQueue = std::multiset<shared_ptr<EventInfo>, EventQueueCompare>;
210 unique_ptr<util::detail::SteadyTimer> m_timer;
211 bool m_isEventExecuting =
false;
224 namespace scheduler = util::scheduler;
232 #endif // NDN_UTIL_SCHEDULER_HPP bool operator!=(const EventId &other) const noexcept
Generic time-based scheduler.
std::ostream & operator<<(std::ostream &os, LoggerTimestamp)
Write a timestamp to os.
EventId scheduleEvent(time::nanoseconds after, EventCallback callback)
ScopedEventId(Scheduler &) noexcept
scheduler::Scheduler deprecated
EventId(std::nullptr_t) noexcept
Allow implicit conversion from nullptr.
std::function< void()> EventCallback
Function to be invoked when a scheduled event expires.
A scoped handle of scheduled event.
Handle to cancel an operation.
bool operator==(const Data &lhs, const Data &rhs)
void cancelEvent(const EventId &eid)
void cancel() const
Cancel the operation.
A handle of scheduled event.
Cancels an operation automatically upon destruction.