utils: Removing concept of periodic event from Scheduler
Change-Id: I66563ec50a54e959974b516ae45357bc4797b67f
Refs: #1670
diff --git a/src/util/scheduler.cpp b/src/util/scheduler.cpp
index 9cf2357..d51f83d 100644
--- a/src/util/scheduler.cpp
+++ b/src/util/scheduler.cpp
@@ -63,10 +63,8 @@
};
Scheduler::EventInfo::EventInfo(const time::nanoseconds& after,
- const time::nanoseconds& period,
const Event& event)
: m_scheduledTime(time::steady_clock::now() + after)
- , m_period(period)
, m_event(event)
{
}
@@ -74,7 +72,6 @@
Scheduler::EventInfo::EventInfo(const time::steady_clock::TimePoint& when,
const EventInfo& previousEvent)
: m_scheduledTime(when)
- , m_period(previousEvent.m_period)
, m_event(previousEvent.m_event)
, m_eventId(previousEvent.m_eventId)
{
@@ -102,15 +99,7 @@
Scheduler::scheduleEvent(const time::nanoseconds& after,
const Event& event)
{
- return schedulePeriodicEvent(after, time::nanoseconds(-1), event);
-}
-
-EventId
-Scheduler::schedulePeriodicEvent(const time::nanoseconds& after,
- const time::nanoseconds& period,
- const Event& event)
-{
- EventQueue::iterator i = m_events.insert(EventInfo(after, period, event));
+ EventQueue::iterator i = m_events.insert(EventInfo(after, event));
// On OSX 10.9, boost, and C++03 the following doesn't work without ndn::
// because the argument-dependent lookup prefers STL to boost
@@ -178,19 +167,8 @@
EventQueue::iterator head = m_events.begin();
Event event = head->m_event;
- if (head->m_period < time::nanoseconds::zero())
- {
- head->m_eventId->invalidate();
- m_events.erase(head);
- }
- else
- {
- // "reschedule" and update EventId data of the event
- EventInfo event(now + head->m_period, *head);
- EventQueue::iterator i = m_events.insert(event);
- i->m_eventId->reset(i);
- m_events.erase(head);
- }
+ head->m_eventId->invalidate();
+ m_events.erase(head);
event();
}
diff --git a/src/util/scheduler.hpp b/src/util/scheduler.hpp
index 1e5b80a..bf6ada5 100644
--- a/src/util/scheduler.hpp
+++ b/src/util/scheduler.hpp
@@ -53,16 +53,6 @@
scheduleEvent(const time::nanoseconds& after, const Event& event);
/**
- * \brief Schedule periodic event that should be fired every specified period.
- * First event will be fired after the specified delay.
- * \returns EventId that can be used to cancel the scheduled event
- */
- EventId
- schedulePeriodicEvent(const time::nanoseconds& after,
- const time::nanoseconds& period,
- const Event& event);
-
- /**
* \brief Cancel scheduled event
*/
void
@@ -75,9 +65,7 @@
private:
struct EventInfo
{
- EventInfo(const time::nanoseconds& after,
- const time::nanoseconds& period,
- const Event& event);
+ EventInfo(const time::nanoseconds& after, const Event& event);
EventInfo(const time::steady_clock::TimePoint& when, const EventInfo& previousEvent);
@@ -97,7 +85,6 @@
expiresFromNow() const;
time::steady_clock::TimePoint m_scheduledTime;
- time::nanoseconds m_period;
Event m_event;
mutable EventId m_eventId;
};