2022-12-07 14:03:34 +00:00
|
|
|
#pragma once
|
|
|
|
#include "thread/Thread.h"
|
2023-01-05 20:52:26 +00:00
|
|
|
#include <luna/TarStream.h>
|
2022-12-07 14:03:34 +00:00
|
|
|
|
|
|
|
namespace Scheduler
|
|
|
|
{
|
|
|
|
void init();
|
|
|
|
|
|
|
|
Thread* current();
|
2022-12-07 14:55:58 +00:00
|
|
|
Thread* idle();
|
2022-12-07 14:03:34 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2023-01-05 20:52:26 +00:00
|
|
|
Result<void> new_userspace_thread(const TarStream::Entry& entry, const TarStream& stream);
|
|
|
|
|
2022-12-07 14:03:34 +00:00
|
|
|
Thread* pick_task();
|
|
|
|
|
2022-12-19 11:24:15 +00:00
|
|
|
void reap_thread(Thread* thread);
|
|
|
|
|
2022-12-07 14:03:34 +00:00
|
|
|
void switch_task(Registers* regs);
|
|
|
|
|
|
|
|
void invoke(Registers* regs);
|
2022-12-18 17:43:34 +00:00
|
|
|
|
2022-12-19 11:43:23 +00:00
|
|
|
LinkedList<Thread> check_for_dying_threads();
|
2022-12-07 14:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" void kernel_yield();
|
2022-12-18 17:43:34 +00:00
|
|
|
void kernel_sleep(u64 ms);
|
2023-01-02 12:07:29 +00:00
|
|
|
[[noreturn]] void kernel_exit();
|