From 3e3ba08b7f8483430946ac7db0cc3bdbaa6f8a90 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Tue, 10 Apr 2012 16:26:26 -0700 Subject: [PATCH] scheduler: kill 'replaceable' scheduler I don't actually need a replaceable scheduler; I need a scheduler that can switch policies at will. Just remove this level of abstraction for now (it can be added later if needed). --- model.cc | 2 +- schedule.cc | 6 +++--- schedule.h | 7 ------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/model.cc b/model.cc index 62b2925..d929c48 100644 --- a/model.cc +++ b/model.cc @@ -11,7 +11,7 @@ ModelChecker::ModelChecker() /* First thread created (system_thread) will have id 1 */ this->used_thread_id = 0; /* Initialize default scheduler */ - this->scheduler = new DefaultScheduler(); + this->scheduler = new Scheduler(); this->current_action = NULL; } diff --git a/schedule.cc b/schedule.cc index 0dae851..abb3e4b 100644 --- a/schedule.cc +++ b/schedule.cc @@ -3,13 +3,13 @@ #include "common.h" #include "model.h" -void DefaultScheduler::add_thread(struct thread *t) +void Scheduler::add_thread(struct thread *t) { DEBUG("thread %d\n", t->id); queue.push(t); } -struct thread *DefaultScheduler::next_thread(void) +struct thread *Scheduler::next_thread(void) { if (queue.empty()) return NULL; @@ -20,7 +20,7 @@ struct thread *DefaultScheduler::next_thread(void) return current; } -struct thread *DefaultScheduler::get_current_thread(void) +struct thread *Scheduler::get_current_thread(void) { return current; } diff --git a/schedule.h b/schedule.h index 8e30675..8341600 100644 --- a/schedule.h +++ b/schedule.h @@ -7,13 +7,6 @@ #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; -}; - -class DefaultScheduler: public Scheduler { public: void add_thread(struct thread *t); struct thread * next_thread(void); -- 2.34.1