1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
pub mod context;
pub mod process;
pub mod proc_list;
pub mod coop_sched;
use self::coop_sched as scheduler;
pub use self::process::{Process, ProcessId, State};
pub use self::proc_list::ProcessList;
pub use self::scheduler::Scheduler;
use core::result::Result;
use alloc::string::String;
pub trait Scheduling {
fn create(&self, func: extern "C" fn(), name: String) -> Result<ProcessId, i16>;
fn get_id(&self) -> ProcessId;
fn kill(&self, id: ProcessId);
fn ready(&self, id: ProcessId);
unsafe fn resched(&self);
}
pub const MAX_PROCS: usize = usize::max_value() - 1;
pub const INITIAL_STACK: usize = 1024;
lazy_static! {
pub static ref SCHEDULER: Scheduler = Scheduler::new();
}