Exemplo n.º 1
0
void dump_tasks() {
  WARNING("---- %d Active Tasks ----\n", all_tasks.size());
  for (task_list::iterator task_it = all_tasks.begin();
      task_it != all_tasks.end(); task_it++) {
    (*task_it)->dump();
  }
}
Exemplo n.º 2
0
void Bacon::Run()
{
	running = true;
	while (running)
	{
		//assert( !"NOTI" ); //What is this tomfoolery? Seriously. What is this?

		sf::Event Event;
        while(appWindow->GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                Shutdown();
        }

		// tick each of our active tasks
		// note that we want the active appstate's tasks,
		// not a fixed list!
		task_list::iterator it;
		for( it = tasks.begin(); it != tasks.end(); it++ )
			(*it)->Tick();


		// call some python code; tick the physics; render the frame

		appWindow->Display();
	}
}
Exemplo n.º 3
0
void abort_all_tasks()
{
    for (task_list::iterator task_it = all_tasks.begin();
         task_it != all_tasks.end();
         task_it = all_tasks.begin()) {
        (*task_it)->abort();
    }
}
Exemplo n.º 4
0
/* Remove this task from the run queue. */
bool task::remove_from_runqueue() {
  if (!this->running) {
    return false;
  }
  running_tasks.erase(this->runit);
  this->running = false;
  return true;
}
Exemplo n.º 5
0
task::~task() {
  if (running) {
    remove_from_runqueue();
  } else {
    paused_tasks.remove_paused_task(this);
  }
  all_tasks.erase(taskit);
}
Exemplo n.º 6
0
void task::spawn_and_wait_for_all( task_list& list ) {
    generic_scheduler* s = governor::local_scheduler();
    task* t = list.first;
    if( t ) {
        if( &t->prefix().next!=list.next_ptr )
            s->local_spawn( *t->prefix().next, *list.next_ptr );
        list.clear();
    }
    s->local_wait_for_all( *this, t );
}
Exemplo n.º 7
0
bool task_list::operator==(const task_list& rhs) const
{
	if(size()!=rhs.size())
		return false;

	bool match=true;

	for(unsigned int ii=0;ii<size();++ii)
	{
		if(list_[ii]!=rhs[ii])
		{
			match=false;
			break;
		}
	}

	return match;
}
Exemplo n.º 8
0
task::task()
{
    this->taskit = all_tasks.insert(all_tasks.end(), this);
    add_to_runqueue();
}
Exemplo n.º 9
0
/* Put this task in the run queue. */
void task::add_to_runqueue()
{
    this->runit = running_tasks.insert(running_tasks.end(), this);
    this->running = true;
}
Exemplo n.º 10
0
    void delete_tasks () {
	for (task_iter i = m_tasks.begin(); i != m_tasks.end(); i++)
	    delete *i;
    }
Exemplo n.º 11
0
    bool has_tasks () {
	return !m_tasks.empty();
    }
Exemplo n.º 12
0
    void detach (task* task) {
	m_tasks.remove(task);
	task->m_mgr = NULL;
    };
Exemplo n.º 13
0
    void attach (task* task) {
	m_tasks.push_back(task);
	task->m_mgr = this;
    };