#pragma once
|
|
|
|
#include "gp/containers/indexed_array.hpp"
|
|
#include "gp/system/process_data.hpp"
|
|
#include "gp/system/task_queue.hpp"
|
|
|
|
namespace gp {
|
|
namespace system {
|
|
class system;
|
|
|
|
struct scheduler {
|
|
task_queue::node_ptr previous;
|
|
task_queue::node_ptr current;
|
|
size_t id;
|
|
system& sys;
|
|
process_data main_context_data;
|
|
task_queue::node main_context;
|
|
|
|
no_inline_decl(
|
|
void yield_to(task_queue::node_ptr target)
|
|
);
|
|
|
|
scheduler(system&, size_t token);
|
|
|
|
scheduler(scheduler&& v)
|
|
: previous(v.previous)
|
|
, current(v.current)
|
|
, id(v.id)
|
|
, sys(v.sys)
|
|
, main_context_data(gp::move(v.main_context_data))
|
|
, main_context(gp::move(v.main_context))
|
|
{}
|
|
|
|
void run();
|
|
|
|
void yield();
|
|
|
|
~scheduler() {
|
|
|
|
}
|
|
};
|
|
|
|
}
|
|
}
|