Esempio n. 1
0
  void PeriodicTaskPrivate::_trigger(qi::Future<void> future)
  {
    // if future was not canceled, the task already ran, don't retrigger
    if (!future.isCanceled())
      return;

    // else, start the task now if we are still triggering
    if (_state.setIfEquals(Task_Triggering, Task_Rescheduling))
      _reschedule(0);
  }
Esempio n. 2
0
 void PeriodicTaskPrivate::_onTaskFinished(const qi::Future<void>& fut)
 {
   if (fut.isCanceled())
   {
     qiLogDebug() << "run canceled";
     boost::mutex::scoped_lock l(_mutex);
     if (_state == TaskState::Stopping)
       _state = TaskState::Stopped;
     else if (_state == TaskState::Triggering)
       _state = TaskState::TriggerReady;
     else
     {
       QI_ASSERT(false && "state is not stopping nor triggering");
     }
     _cond.notify_all();
   }
 }