Skip to content
Snippets Groups Projects
Commit a731ffc1 authored by Avi Kivity's avatar Avi Kivity
Browse files

sched: rearrange declaration order

No functional changes - prepare for making timer lists cpu local.
parent 60085619
No related branches found
No related tags found
No related merge requests found
......@@ -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(); }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment