update schedule to better support reschedule
diff --git a/scheduler/scheduler.cc b/scheduler/scheduler.cc
index 7bdf2d6..e12b64c 100644
--- a/scheduler/scheduler.cc
+++ b/scheduler/scheduler.cc
@@ -121,6 +121,27 @@
 }
 
 void
+Scheduler::rescheduleTask(const TaskPtr &task)
+{
+  ReadLock lock(m_mutex);
+  TaskMapIt it = m_taskMap.find(tag);
+  if (it != m_taskMap.end())
+  {
+    TaskPtr task = it->second;
+    task->reset();
+    int res = evtimer_add(task->ev(), task->tv());
+    if (res < 0)
+    {
+      cout << "evtimer_add failed for " << task->tag() << endl;
+    }
+  }
+  else
+  {
+    addTask(task);
+  }
+}
+
+void
 Scheduler::rescheduleTask(const Task::Tag &tag)
 {
   ReadLock lock(m_mutex);
diff --git a/scheduler/scheduler.h b/scheduler/scheduler.h
index e3487a9..83b9926 100644
--- a/scheduler/scheduler.h
+++ b/scheduler/scheduler.h
@@ -82,6 +82,14 @@
   virtual void
   rescheduleTask(const Task::Tag &tag);
 
+  // if the task is not pending, it will be added to the schedule queue
+  // if the task is pending, the delay is changed to the passed in delay
+  // e.g. if at second 0 task A with delay 5 is originally going to run at second 5 and
+  // rescheduleTask(A) is called at second 4, A will be reschedule to run
+  // at second 9
+  virtual void
+  rescheduleTask(const TaskPtr &task);
+
   void
   eventLoop();