#pragma once
|
|
|
|
#include "gp/indexed_array.hpp"
|
|
#include "gp/vfs/process_data.hpp"
|
|
|
|
namespace gp{
|
|
|
|
class system;
|
|
|
|
class scheduler {
|
|
gp::specifics::platform_data root;
|
|
size_t current = 0;
|
|
system& sys;
|
|
|
|
no_inline_decl(
|
|
void yield_to(size_t target_pid)
|
|
);
|
|
|
|
|
|
|
|
public:
|
|
scheduler(class system&);
|
|
|
|
[[noreturn]] void run(allocator& alloc) {
|
|
again:
|
|
run_once();
|
|
cleanup(alloc);
|
|
goto again;
|
|
}
|
|
|
|
void cleanup(allocator& alloc);
|
|
|
|
void run_once();
|
|
|
|
void yield(){
|
|
yield_to(0);
|
|
}
|
|
};
|
|
|
|
}
|