]> git.corax.cc Git - corax/commitdiff
Add generic scheduler interface, to be implemented by all schedulers
authorMatthias Kruk <m@m10k.eu>
Sat, 1 Feb 2020 06:47:15 +0000 (15:47 +0900)
committerMatthias Kruk <m@m10k.eu>
Sat, 1 Feb 2020 06:47:15 +0000 (15:47 +0900)
kernel/include/sched.h

index 7efa3997a1564f0f4360e06a972959bbc6c4fa0a..7e059a83c9fb1cad49560110472737885cd59882 100644 (file)
@@ -3,6 +3,25 @@
 
 #include <config.h>
 
+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);