#ifndef __PROCESS_H #define __PROCESS_H #include "list.h" enum State { IDLE, RUNNING, TERMINATED }; struct process; typedef void (*process_body_fun_t)(struct process *p); struct process { const char *name; // name (for debugging) enum State state; // current state of this process int ev_time; // next event time for this process struct scheduler *scheduler; // associated scheduler process_body_fun_t body; // this process's body struct list_elem eventelem; // for membership in eventlist struct list_elem elem; // for membership in one additional list /* add more here */ }; void process_block(struct process *self); void process_unblock(struct process *self); bool process_terminated(struct process *self); void process_cancel(struct process *self); void process_terminate(struct process *self); bool process_active(struct process *self); void process_waitq(struct process *self, struct list *q); void process_print(struct process *self); bool process_scheduled(struct process *self); void process_init(struct process *p, const char *name, struct scheduler *sched, process_body_fun_t body); #endif /* __PROCESS_H */