another example
[model-checker.git] / schedule.h
1 /** @file schedule.h
2  *      @brief Thread scheduler.
3  */
4
5 #ifndef __SCHEDULE_H__
6 #define __SCHEDULE_H__
7
8 #include <list>
9 #include "mymemory.h"
10
11 /* Forward declaration */
12 class Thread;
13
14 /** @brief The Scheduler class performs the mechanics of Thread execution
15  * scheduling. */
16 class Scheduler {
17 public:
18         Scheduler();
19         void add_thread(Thread *t);
20         void remove_thread(Thread *t);
21         Thread * next_thread(Thread *t);
22         Thread * get_current_thread() const;
23         void print() const;
24
25         SNAPSHOTALLOC
26 private:
27         /** The list of available Threads that are not currently running */
28         std::list<Thread *> readyList;
29
30         /** The currently-running Thread */
31         Thread *current;
32 };
33
34 #endif /* __SCHEDULE_H__ */