1 /* -*- Mode: C; indent-tabs-mode: t -*- */
8 Scheduler::Scheduler():
13 void Scheduler::add_thread(Thread *t)
15 DEBUG("thread %d\n", t->get_id());
16 readyList.push_back(t);
19 void Scheduler::remove_thread(Thread *t)
27 Thread * Scheduler::next_thread(void)
29 Thread *t = model->schedule_next_thread();
34 } else if (readyList.empty()) {
37 t = readyList.front();
39 readyList.pop_front();
47 Thread * Scheduler::get_current_thread(void)
52 void Scheduler::print()
55 DEBUG("Current thread: %d\n", current->get_id());
57 DEBUG("No current thread\n");
58 DEBUG("Num. threads in ready list: %zu\n", readyList.size());
60 std::list<Thread *, MyAlloc< Thread * > >::iterator it;
61 for (it = readyList.begin(); it != readyList.end(); it++)
62 DEBUG("In ready list: thread %d\n", (*it)->get_id());