schedule: print debug info
[model-checker.git] / schedule.cc
index 13b640cd8e832b2cca826e5a4b68d66143bb854c..2498347c44cc6e2cb6cbb870a829465c318504db 100644 (file)
@@ -13,6 +13,8 @@ Thread *Scheduler::next_thread(void)
 {
        Thread *t = model->schedule_next_thread();
 
+       print();
+
        if (t != NULL) {
                readyList.remove(t);
                return t;
@@ -30,3 +32,16 @@ Thread *Scheduler::get_current_thread(void)
 {
        return current;
 }
+
+void Scheduler::print()
+{
+       if (current)
+               printf("Current thread: %d\n", current->get_id());
+       else
+               printf("No current thread\n");
+       printf("# Threads in ready list: %ld\n", readyList.size());
+
+       std::list<Thread *>::iterator it;
+       for (it = readyList.begin(); it != readyList.end(); it++)
+               printf("In ready list: thread %d\n", (*it)->get_id());
+}