From: Brian Norris Date: Thu, 15 Mar 2012 05:56:30 +0000 (-0700) Subject: schedule: make 'current' a private member of the scheduler X-Git-Url: http://plrg.eecs.uci.edu/git/?p=cdsspec-compiler.git;a=commitdiff_plain;h=5f6566b5bd21517d0f963011ddf7bd919f8da7b9 schedule: make 'current' a private member of the scheduler --- diff --git a/schedule.cc b/schedule.cc index 687d306..c02ca62 100644 --- a/schedule.cc +++ b/schedule.cc @@ -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) diff --git a/schedule.h b/schedule.h index 762e168..aa291ef 100644 --- a/schedule.h +++ b/schedule.h @@ -20,6 +20,7 @@ public: struct thread * get_current_thread(void); private: std::list queue; + struct thread *current; }; #endif /* __SCHEDULE_H__ */