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(); } }
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(); } }
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(); } }
/* 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; }
task::~task() { if (running) { remove_from_runqueue(); } else { paused_tasks.remove_paused_task(this); } all_tasks.erase(taskit); }
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 ); }
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; }
task::task() { this->taskit = all_tasks.insert(all_tasks.end(), this); add_to_runqueue(); }
/* Put this task in the run queue. */ void task::add_to_runqueue() { this->runit = running_tasks.insert(running_tasks.end(), this); this->running = true; }
void delete_tasks () { for (task_iter i = m_tasks.begin(); i != m_tasks.end(); i++) delete *i; }
bool has_tasks () { return !m_tasks.empty(); }
void detach (task* task) { m_tasks.remove(task); task->m_mgr = NULL; };
void attach (task* task) { m_tasks.push_back(task); task->m_mgr = this; };