schedule: make 'current' a private member of the scheduler
[model-checker.git] / schedule.cc
1 #include <stdlib.h>
2
3 #include "libthreads.h"
4 #include "schedule.h"
5 #include "common.h"
6 #include "model.h"
7
8 void DefaultScheduler::add_thread(struct thread *t)
9 {
10         DEBUG("thread %d\n", t->id);
11         queue.push_back(t);
12 }
13
14 struct thread *DefaultScheduler::next_thread(void)
15 {
16         if (queue.empty())
17                 return NULL;
18
19         current = queue.front();
20         queue.pop_front();
21
22         return current;
23 }
24
25 struct thread *DefaultScheduler::get_current_thread(void)
26 {
27         return current;
28 }