Luna/kernel/src/thread/Scheduler.h
apio a33a72915e
Scheduler: Creation, destruction and switching of userspace tasks :))
From a TarStream. Not optimal, but OK for the moment.
2023-01-05 21:52:26 +01:00

32 lines
708 B
C++

#pragma once
#include "thread/Thread.h"
#include <luna/TarStream.h>
namespace Scheduler
{
void init();
Thread* current();
Thread* idle();
Result<void> new_kernel_thread(u64 address);
Result<void> new_kernel_thread(void (*func)(void));
Result<void> new_kernel_thread(void (*func)(void*), void* arg);
Result<void> new_userspace_thread(const TarStream::Entry& entry, const TarStream& stream);
Thread* pick_task();
void reap_thread(Thread* thread);
void switch_task(Registers* regs);
void invoke(Registers* regs);
LinkedList<Thread> check_for_dying_threads();
}
extern "C" void kernel_yield();
void kernel_sleep(u64 ms);
[[noreturn]] void kernel_exit();