From 7be196272ae61068937b79bb24ca6abd4bde7cb6 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sat, 1 Feb 2020 15:47:15 +0900 Subject: [PATCH] Add generic scheduler interface, to be implemented by all schedulers --- kernel/include/sched.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/kernel/include/sched.h b/kernel/include/sched.h index 7efa399..7e059a8 100644 --- a/kernel/include/sched.h +++ b/kernel/include/sched.h @@ -3,6 +3,25 @@ #include +struct task; + +typedef enum { + SCHED_TASK_READY, + SCHED_TASK_RUNNING, + SCHED_TASK_SLEEPING +} sched_task_state_t; + +struct sched { + int (*tick)(struct sched*); + + int (*sleep)(struct sched*, struct task*); + int (*wakeup)(struct sched*, struct task*, int); + + int (*schedule)(struct sched*, struct task*); + int (*drop)(struct sched*, struct task*); + int (*nice)(struct sched*, struct task*, int); +}; + void sched_tick(void); void sched_wait(pid_t); int sched_raise(pid_t); -- 2.47.3