aboutsummaryrefslogtreecommitdiff
path: root/include/sys
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-18 12:57:53 -0700
committerChristian Cunningham <cc@localhost>2022-03-18 12:57:53 -0700
commit94f2b0b8f48f5715975446c637a078008fb7e941 (patch)
tree2fb1744748e3bd4c93b2dae65a6033763c17e737 /include/sys
parent7ea4a4e970ae4a72ac7b58e98d232662d580ed47 (diff)
Generalized Queue
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/schedule.h25
1 files changed, 5 insertions, 20 deletions
diff --git a/include/sys/schedule.h b/include/sys/schedule.h
index d0d938c..18b2f7f 100644
--- a/include/sys/schedule.h
+++ b/include/sys/schedule.h
@@ -1,5 +1,6 @@
#ifndef SYS_SCHEDULE_H
#define SYS_SCHEDULE_H
+#include <lib/queue.h>
#define TQUEUE_MAX 0x800
#define STACK_SIZE 0x4000
@@ -13,12 +14,6 @@ enum ThreadStatus {
THREAD_SWAIT = 2,
};
-enum EntryTypes {
- THREAD_ENTRY = 0,
- START_ENTRY = 1,
- END_ENTRY = 2,
-};
-
struct Thread {
void* pc;
void* sp; // Store r0-r12,lr on stack
@@ -35,22 +30,12 @@ struct Thread {
unsigned short s_reserved;
};
-struct ThreadEntry {
- struct Thread* thread;
- struct ThreadEntry* next;
- unsigned long entry_type;
-};
-
-struct ThreadQueue {
- struct ThreadEntry start;
- struct ThreadEntry end;
-};
-
struct Scheduler {
struct Thread* rthread;
- struct ThreadQueue ready[PRIORITIES];
- struct ThreadQueue mwait[PRIORITIES];
- struct ThreadQueue swait[PRIORITIES];
+ struct Queue ready[PRIORITIES];
+ struct Queue mwait[PRIORITIES];
+ struct Queue swait[PRIORITIES];
+ struct Queue free_threads;
};
void init_scheduler(void);