X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=schedule.h;h=3feddd9025915e9275efc1bf4aca389a1a17844f;hb=27a6b2d336785fa3d30d937a397242c0a6823cfc;hp=68ef11106d080afddd6857a322e6d254501554a3;hpb=0e49f3778dcb00bcf9c1690b37864021822d5353;p=model-checker.git diff --git a/schedule.h b/schedule.h index 68ef111..3feddd9 100644 --- a/schedule.h +++ b/schedule.h @@ -11,6 +11,12 @@ /* Forward declaration */ class Thread; +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. */ class Scheduler { @@ -18,14 +24,21 @@ public: Scheduler(); void add_thread(Thread *t); void remove_thread(Thread *t); - Thread * next_thread(); + void sleep(Thread *t); + void wake(Thread *t); + Thread * next_thread(Thread *t); Thread * get_current_thread() const; - void print(); + void print() const; + enabled_type_t * get_enabled() { return enabled; }; + bool is_enabled(Thread *t) 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;