Simple scheduler

This commit is contained in:
thomas committed 2018-03-21 23:12:43 +01:00
1 parent 1e2f81a5d8
commit 251b5f71c9
5 files changed
+50 -23

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
#pragma once
void ready(struct thread *th);
struct thread *scheduler_next();
+4 -5
View File
@@ -7,6 +7,7 @@ struct tcb
uintptr_t stack_ptr;
uint64_t tid;
uint64_t state;
struct thread *next;
};
#define TCB_OFFSET (PAGE_SIZE - sizeof(struct tcb))
@@ -31,12 +32,10 @@ struct thread
struct tcb tcb;
};
extern struct thread *threads[];
int current_tid;
struct thread *current_thread;
#define CURRENT_THREAD() (current_thread)
#define CURRENT_THREAD() (threads[current_tid])
struct thread *new_thread(void (*function)());
struct thread *new_thread(void (*function)(void));
void yield();
int get_tid();