2 * @brief Thread scheduler.
9 #include "modeltypes.h"
11 /* Forward declaration */
16 typedef enum enabled_type {
22 void enabled_type_to_string(enabled_type_t e, char *str);
24 /** @brief The Scheduler class performs the mechanics of Thread execution
29 void register_engine(ModelExecution *execution);
31 void add_thread(Thread *t);
32 void remove_thread(Thread *t);
33 void sleep(Thread *t);
35 Thread * select_next_thread(Node *n);
36 void set_current_thread(Thread *t);
37 Thread * get_current_thread() const;
39 enabled_type_t * get_enabled_array() const { return enabled; };
40 void remove_sleep(Thread *t);
41 void add_sleep(Thread *t);
42 enabled_type_t get_enabled(const Thread *t) const;
43 void update_sleep_set(Node *n);
44 bool is_enabled(const Thread *t) const;
45 bool is_enabled(thread_id_t tid) const;
46 bool is_sleep_set(const Thread *t) const;
47 bool all_threads_sleeping() const;
48 void set_scheduler_thread(thread_id_t tid);
52 ModelExecution *execution;
53 /** The list of available Threads that are not currently running */
54 enabled_type_t *enabled;
56 int curr_thread_index;
57 void set_enabled(Thread *t, enabled_type_t enabled_status);
59 /** The currently-running Thread */
63 #endif /* __SCHEDULE_H__ */