From a731ffc12a4b32dbe6fc23f35a3953a29027a302 Mon Sep 17 00:00:00 2001 From: Avi Kivity <avi@cloudius-systems.com> Date: Thu, 7 Feb 2013 15:12:12 +0200 Subject: [PATCH] sched: rearrange declaration order No functional changes - prepare for making timer lists cpu local. --- include/sched.hh | 52 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/include/sched.hh b/include/sched.hh index dd4d60558..4fd11074b 100644 --- a/include/sched.hh +++ b/include/sched.hh @@ -22,6 +22,8 @@ namespace sched { class thread; class cpu; +class timer; +class timer_list; void schedule(bool yield = false); @@ -31,6 +33,21 @@ extern "C" { namespace bi = boost::intrusive; +class timer : public bi::set_base_hook<> { +public: + explicit timer(thread& t); + ~timer(); + void set(u64 time); + bool expired() const; + void cancel(); + friend bool operator<(const timer& t1, const timer& t2); +private: + thread& _t; + bool _expired; + u64 _time; + friend class timer_list; +}; + class thread { public: struct stack_info { @@ -86,6 +103,15 @@ public: bi::list_member_hook<> _thread_list_link; }; +class timer_list : private clock_event_callback { +public: + timer_list(); + virtual void fired(); +private: + friend class timer; + bi::set<timer, bi::base_hook<bi::set_base_hook<>>> _list; +}; + typedef bi::list<thread, bi::member_hook<thread, bi::list_member_hook<>, @@ -108,32 +134,6 @@ struct cpu { thread* current(); -class timer; - -class timer_list : private clock_event_callback { -public: - timer_list(); - virtual void fired(); -private: - friend class timer; - bi::set<timer, bi::base_hook<bi::set_base_hook<>>> _list; -}; - -class timer : public bi::set_base_hook<> { -public: - explicit timer(thread& t); - ~timer(); - void set(u64 time); - bool expired() const; - void cancel(); - friend bool operator<(const timer& t1, const timer& t2); -private: - thread& _t; - bool _expired; - u64 _time; - friend class timer_list; -}; - class wait_guard { public: wait_guard(thread* t) : _t(t) { t->prepare_wait(); } -- GitLab