schedule: make 'current' a private member of the scheduler
[model-checker.git] / schedule.cc
index 687d30612d2e2c3549caf4e922210885fad94941..c02ca62b12a16cd1c07d58ffd20f1ac383b57181 100644 (file)
@@ -5,8 +5,6 @@
 #include "common.h"
 #include "model.h"
 
-struct thread *current;
-
 void DefaultScheduler::add_thread(struct thread *t)
 {
        DEBUG("thread %d\n", t->id);
@@ -15,17 +13,13 @@ void DefaultScheduler::add_thread(struct thread *t)
 
 struct thread *DefaultScheduler::next_thread(void)
 {
-       struct thread *t;
-
        if (queue.empty())
                return NULL;
 
-       t = queue.front();
+       current = queue.front();
        queue.pop_front();
 
-       current = t;
-
-       return t;
+       return current;
 }
 
 struct thread *DefaultScheduler::get_current_thread(void)