aboutsummaryrefslogtreecommitdiff
path: root/later/schedule.flat.c
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-01-03 20:10:10 -0800
committerChristian Cunningham <cc@localhost>2022-01-03 20:10:10 -0800
commit1b180d2f15e9b726e6e9dde5601f41fa48c1c044 (patch)
tree837de56031b3c26b62e8773d2bc671b38da12e53 /later/schedule.flat.c
parent3448a072fab683b97c93922b2d150e530a22b5a3 (diff)
Ensured Aligned Mutexes
Diffstat (limited to 'later/schedule.flat.c')
-rw-r--r--later/schedule.flat.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/later/schedule.flat.c b/later/schedule.flat.c
new file mode 100644
index 0000000..6eb0d14
--- /dev/null
+++ b/later/schedule.flat.c
@@ -0,0 +1,32 @@
+#ifdef FLAT
+
+#include "../sys/schedule.h"
+static struct Task* task_list[256];
+
+static struct Scheduler scheduler = {
+ .tasks = task_list,
+};
+
+static unsigned int ntask_i = 0;
+
+void add_task(struct Task* t)
+{
+ scheduler.tasks[ntask_i] = t;
+ ntask_i += 1;
+ if (ntask_i > 256) {
+ ntask_i = 0;
+ }
+}
+
+unsigned int get_task_length(void)
+{
+ return ntask_i;
+}
+
+void execute_task(void)
+{
+ if (scheduler.tasks[ntask_i-1] != 0)
+ scheduler.tasks[ntask_i-1]->task();
+}
+
+#endif