X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=schedule.h;h=da91fddf976c8dd880a57b98476b9e3af76cdffd;hb=75ebee456936b1f68da592800b4ad0af57d830cf;hp=c3d029fb2ed4b77246889ad8f7a070b7893a080a;hpb=2eb6b99ea42e152d878a8c4805f3cf119f316c3e;p=c11tester.git diff --git a/schedule.h b/schedule.h index c3d029fb..da91fddf 100644 --- a/schedule.h +++ b/schedule.h @@ -10,6 +10,13 @@ /* Forward declaration */ class Thread; +class Node; + +typedef enum enabled_type { + THREAD_DISABLED, + THREAD_ENABLED, + THREAD_SLEEP_SET +} enabled_type_t; /** @brief The Scheduler class performs the mechanics of Thread execution * scheduling. */ @@ -18,14 +25,26 @@ public: Scheduler(); void add_thread(Thread *t); void remove_thread(Thread *t); + void sleep(Thread *t); + void wake(Thread *t); Thread * next_thread(Thread *t); Thread * get_current_thread() const; void print() const; + enabled_type_t * get_enabled() { return enabled; }; + void remove_sleep(Thread *t); + void add_sleep(Thread *t); + enabled_type_t get_enabled(Thread *t); + void update_sleep_set(Node *n); + bool is_enabled(Thread *t) const; + bool is_enabled(thread_id_t tid) const; SNAPSHOTALLOC private: /** The list of available Threads that are not currently running */ - std::list readyList; + enabled_type_t *enabled; + int enabled_len; + int curr_thread_index; + void set_enabled(Thread *t, enabled_type_t enabled_status); /** The currently-running Thread */ Thread *current;