aboutsummaryrefslogtreecommitdiff
path: root/include/sys
diff options
context:
space:
mode:
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/schedule.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/include/sys/schedule.h b/include/sys/schedule.h
index 397ab2e..0205f54 100644
--- a/include/sys/schedule.h
+++ b/include/sys/schedule.h
@@ -30,24 +30,29 @@ struct Thread {
unsigned short s_reserved;
};
-struct ThreadRotBuffer {
- unsigned int roffset;
- unsigned int woffset;
- struct Thread* queue[TQUEUE_MAX];
+struct ThreadEntry {
+ struct Thread* thread;
+ struct ThreadEntry* prev;
+ struct ThreadEntry* next;
};
-struct ThreadQueues {
- struct ThreadRotBuffer ready;
- struct ThreadRotBuffer mwait;
- struct ThreadRotBuffer swait;
+struct ThreadEntryIterator {
+ struct ThreadEntry* entry;
+};
+
+struct ThreadQueue {
+ struct ThreadEntry entry[TQUEUE_MAX];
+ struct ThreadEntryIterator read;
+ struct ThreadEntryIterator write;
};
struct Scheduler {
struct Thread* rthread;
- struct ThreadQueues thread_queues[PRIORITIES];
+ struct ThreadQueue ready[PRIORITIES];
+ struct ThreadQueue mwait[PRIORITIES];
+ struct ThreadQueue swait[PRIORITIES];
};
-
void init_scheduler(void);
void add_thread(void* pc, void* arg, unsigned char priority);
void uart_scheduler(void);