#pragma once #include "fs/VFS.h" #include "thread/Thread.h" namespace Scheduler { void init(); Thread* current(); Thread* idle(); Result new_kernel_thread(u64 address); Result new_kernel_thread(void (*func)(void)); Result new_kernel_thread(void (*func)(void*), void* arg); Result new_userspace_thread(SharedPtr inode); void add_thread(Thread* thread); Thread* pick_task(); void reap_thread(Thread* thread); void switch_task(Registers* regs); void invoke(Registers* regs); LinkedList check_for_dying_threads(); Option find_by_pid(pid_t pid); template void for_each_child(pid_t pid, Callback callback) { g_threads.for_each([&](Thread* thread) { if (thread->parent_id == (u64)pid) callback(thread); }); } bool has_children(pid_t pid); Option find_exited_child(pid_t pid); } extern "C" void kernel_yield(); void kernel_sleep(u64 ms); [[noreturn]] void kernel_exit();