schedule: use STL list class instead of custom queue
[model-checker.git] / schedule.h
index ac69fa1163bfdfb3d8aff5a1f4ad249cdecb54e0..762e16818ed220dfc3a313a0b297638d7e9bfddd 100644 (file)
@@ -1,9 +1,25 @@
 #ifndef __SCHEDULE_H__
 #define __SCHEDULE_H__
 
+#include <list>
+
 #include "libthreads.h"
+#include "model.h"
+
+class Scheduler {
+public:
+       virtual void add_thread(struct thread *t) = 0;
+       virtual struct thread * next_thread(void) = 0;
+       virtual struct thread * get_current_thread(void) = 0;
+};
 
-void schedule_add_thread(struct thread *t);
-struct thread *schedule_choose_next(void);
+class DefaultScheduler: public Scheduler {
+public:
+       void add_thread(struct thread *t);
+       struct thread * next_thread(void);
+       struct thread * get_current_thread(void);
+private:
+       std::list<struct thread *> queue;
+};
 
 #endif /* __SCHEDULE_H__ */