thread implementation

This commit is contained in:
Eggert Jung
2025-06-17 14:17:30 +02:00
parent c1145d28f8
commit 76eb2420bd
2 changed files with 9 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
// vim: set noet ts=4 sw=4:
#include "thread.h"
#include "../arch/context.h"
// Alias to simplify stuff
typedef void (*kickoff_t)(void*);
@@ -10,14 +11,17 @@ void Thread::kickoff(Thread* object) {
}
Thread::Thread(void* tos) {
prepareContext(tos, context, (void(*)(void*)) &(kickoff), this);
}
void Thread::resume(Thread* next) {
context_switch(&next->context, &context);
}
void Thread::go() {
context_launch(&context);
}
void Thread::action() {}
void Thread::action() {
while(1);
}