예제 #1
0
bool SecurityHelper::run()
{	
	HAGGLE_DBG("SecurityHelper running...\n");
	
	while (!shouldExit()) {
		QueueEvent_t qe;
		SecurityTask *task = NULL;
		
		qe = taskQ.retrieve(&task);
		
		switch (qe) {
		case QUEUE_ELEMENT:
			doTask(task);

			// Delete task here or return it with result in private event?
			//delete task;
			break;
		case QUEUE_WATCH_ABANDONED:
			HAGGLE_DBG("SecurityHelper instructed to exit...\n");
			return false;
		default:
			HAGGLE_ERR("Unknown security task queue return value\n");
		}
	}
	return false;
}
예제 #2
0
void NodeStoreScheduler::scheduleTask (NodeStore::Task& task)
{
    ++m_taskCount;
    m_jobQueue->addJob (
        jtWRITE,
        "NodeObject::store",
        [this, &task] (Job&) { doTask(task); });
}
예제 #3
0
bool executeTasks(int* tasks, int noOfTasks) {
	if (taskPointer == noOfTasks) {
    taskPointer = 0;
		return true;
	}
	if (doTask(tasks[taskPointer])) {
		taskPointer++;
	}
	return false;
}
예제 #4
0
파일: Task.cpp 프로젝트: zenkovich/o2
	void FunctionalDelayedTask::DoTask()
	{
		doTask();
	}
예제 #5
0
void Control::interpretator(string line)
{

  /*** Transforms to lower case ***/
  //transform(line.begin(), line.end(), line.begin(),::tolower);

  /*** check for commentation ***/
  string checkComment(line,0,1);
  if(checkComment == "#" || line.size()<2)
    return;

  /*** replaces '{' and '}' with ' { ' and ' } ' ***/
  for(unsigned int i=0; i<line.size(); i++)
    {
      if(string(line,i,1) =="{")
	{
	  line.replace(i, 1, string(" { "),0,3);
	  i++;
	}
      else if(string(line,i,1)=="}")
	{
	  line.replace(i, 1, string(" } "),0,3);
	  i++;
	}
    }  

  /*** break command into words ***/
  vector<string> words;
  words.clear();
  char temp[300];
  istringstream stream(line.c_str());
  while(stream>>temp)
    words.push_back(removeWhite(string(temp)));

  /*** check for lines with only white space ***/
  if(words.size() < 1)
    return;
  /*
  printf("Control has the words:\n");
  for(int i=0;i<words.size();i++)
    printf("'%s' ",words[i].c_str());
  printf("\n");
  */
  
  try
    {
      string com = words.at(0);

      if(com == "load")
	{
	if(words.size() > 2)
	  load(words.at(1), words.at(2));
	else
	  {
	    char no[6];
	    sprintf(no, "%d", soups.size());	 
	    load(words.at(1), string("AutoSoup") + string(no));
	  }
	}
      else if(com == "loadtosoup")
	{
	  if(words.size() > 3)
	    loadToSoup(atoi(words.at(1).c_str()), words.at(2), words.at(3));
	  else
	    {
	      char no[6];
	      sprintf(no, "%d", soups.size());	 
	      load(words.at(1), string("AutoSoup") + string(no));
	    }
	}
      else if(com == "stat")
	stat();
      else if(com == "list")
	list();
      else if(com == "clear")
	clear();
      else if(com == "task")
	doTask(words);
      else if(com == "script")
	do_script(words);
      else if(com == "exit")
	return;
      else
	printf("Don't understand the command '%s'!\n",words.at(0).c_str());
    }
  catch (...)
    {
      printf("The command %s caused a critical error!\n",line.c_str());
    }


}