// vim: set noet ts=4 sw=4: #include "thread.h" #include "../arch/context.h" // Alias to simplify stuff typedef void (*kickoff_t)(void*); void Thread::kickoff(Thread* object) { object->action(); } 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() { while(1); }