Exemple #1
0
void TaskProcessorThread::run() throw ()
{
  RegisterThisFunction fnguard(__PRETTY_FUNCTION__);

  while(true)
    {
      Task *task = m_tasklist -> fetchTask();
      if(task==0)break;

      try
	{
	  task->doTask();
	}
      catch(AbortTask)
	{
	  // This is the only exception that is OK to throw from the Task
	}
      catch(...)
	{
	  // For all other exceptions, we just delete the task and
	  // continue processing. Don't know what else we can do, 
	  // actually we /could/ print out an error also. It's easy to 
	  // change, we'll see how it goes.
	  Debug::stream()
	    << "TaskProcessorThread::run: uncaught exception"
	    << std::endl;
	}
      
      delete(task);
    }
}