Exemple #1
0
VOID Simulator::startScheduler()
{
   LOG_ENTERFN();

   for (;;)
   {
      getMilliSeconds();
      if (KB_KEY_SIM_QUIT == Keyboard::key)
      {
         LOG_INFO("Exiting Simulator");
         break;
      }

      if (Keyboard::key != KB_KEY_PAUSE_TRAFFIC)
      {
         TaskMgr::resumePausedTasks();
      }

      TaskList *pRunningTasks = TaskMgr::getRunningTasks();
      TaskListItr itr = pRunningTasks->begin();
      while (itr != pRunningTasks->end())
      {
         Task *t = *itr;

         // increment the iterator here, because after the task is run
         // it will be paused state which will move the task from running
         // task list to paused task list.
         itr++;
         if (ROK != t->run())
         {
            t->abort();
         }
      }

      getMilliSeconds();

      // read the sockets for keyboard events and gtp messages
      socketPoll(1);
   }
 
   LOG_EXITVOID();
}