Trait rustrt::RuntimeExperimental [-]  [+] [src]

pub trait Runtime {
    fn yield_now(self: Box<Self>, cur_task: Box<Task>);
    fn maybe_yield(self: Box<Self>, cur_task: Box<Task>);
    fn deschedule(self: Box<Self>, times: uint, cur_task: Box<Task>, f: |BlockedTask| -> Result<(), BlockedTask>);
    fn reawaken(self: Box<Self>, to_wake: Box<Task>);
    fn spawn_sibling(self: Box<Self>, cur_task: Box<Task>, opts: TaskOpts, f: proc(): Send);
    fn stack_bounds(&self) -> (uint, uint);
    fn stack_guard(&self) -> Option<uint>;
    fn can_block(&self) -> bool;
    fn wrap(self: Box<Self>) -> Box<Any + 'static>;
}

The interface to the current runtime.

This trait is used as the abstraction between 1:1 and M:N scheduling. The two independent crates, libnative and libgreen, both have objects which implement this trait. The goal of this trait is to encompass all the fundamental differences in functionality between the 1:1 and M:N runtime modes.

Required Methods

fn yield_now(self: Box<Self>, cur_task: Box<Task>)

fn maybe_yield(self: Box<Self>, cur_task: Box<Task>)

fn deschedule(self: Box<Self>, times: uint, cur_task: Box<Task>, f: |BlockedTask| -> Result<(), BlockedTask>)

fn reawaken(self: Box<Self>, to_wake: Box<Task>)

fn spawn_sibling(self: Box<Self>, cur_task: Box<Task>, opts: TaskOpts, f: proc(): Send)

fn stack_bounds(&self) -> (uint, uint)

The (low, high) edges of the current stack.

fn stack_guard(&self) -> Option<uint>

The last writable byte of the stack next to the guard page

fn can_block(&self) -> bool

fn wrap(self: Box<Self>) -> Box<Any + 'static>

Implementors