util: switch to boost::asio::basic_waitable_timer
Change-Id: I2724befc86482adf84f59063e65509a116bb1b46
Refs: #4431
diff --git a/src/util/scheduler.cpp b/src/util/scheduler.cpp
index 3170f61..167b6e0 100644
--- a/src/util/scheduler.cpp
+++ b/src/util/scheduler.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,7 +20,7 @@
*/
#include "scheduler.hpp"
-#include "detail/monotonic-deadline-timer.hpp"
+#include "detail/steady-timer.hpp"
#include <boost/scope_exit.hpp>
@@ -76,7 +76,7 @@
}
Scheduler::Scheduler(boost::asio::io_service& ioService)
- : m_deadlineTimer(make_unique<detail::MonotonicDeadlineTimer>(ioService))
+ : m_timer(make_unique<detail::SteadyTimer>(ioService))
, m_isEventExecuting(false)
{
}
@@ -108,7 +108,7 @@
}
if (info->queueIt == m_queue.begin()) {
- m_deadlineTimer->cancel();
+ m_timer->cancel();
}
m_queue.erase(info->queueIt);
@@ -121,15 +121,15 @@
Scheduler::cancelAllEvents()
{
m_queue.clear();
- m_deadlineTimer->cancel();
+ m_timer->cancel();
}
void
Scheduler::scheduleNext()
{
if (!m_queue.empty()) {
- m_deadlineTimer->expires_from_now((*m_queue.begin())->expiresFromNow());
- m_deadlineTimer->async_wait(bind(&Scheduler::executeEvent, this, _1));
+ m_timer->expires_from_now((*m_queue.begin())->expiresFromNow());
+ m_timer->async_wait(bind(&Scheduler::executeEvent, this, _1));
}
}
@@ -148,9 +148,9 @@
} BOOST_SCOPE_EXIT_END
// process all expired events
- time::steady_clock::TimePoint now = time::steady_clock::now();
+ auto now = time::steady_clock::now();
while (!m_queue.empty()) {
- EventQueue::iterator head = m_queue.begin();
+ auto head = m_queue.begin();
shared_ptr<EventInfo> info = *head;
if (info->expireTime > now) {
break;