[src]

Trait std::rt::Runtime

pub trait Runtime {
    fn yield_now(~self, cur_task: ~Task);
    fn maybe_yield(~self, cur_task: ~Task);
    fn deschedule(~self, times: uint, cur_task: ~Task, f: |BlockedTask| -> Result<(), BlockedTask>);
    fn reawaken(~self, to_wake: ~Task);
    fn spawn_sibling(~self, cur_task: ~Task, opts: TaskOpts, f: proc());
    fn local_io<'a>(&'a mut self) -> Option<LocalIo<'a>>;
    fn stack_bounds(&self) -> (uint, uint);
    fn can_block(&self) -> bool;
    fn wrap(~self) -> ~Any;
}

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, cur_task: ~Task)

fn maybe_yield(~self, cur_task: ~Task)

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

fn reawaken(~self, to_wake: ~Task)

fn spawn_sibling(~self, cur_task: ~Task, opts: TaskOpts, f: proc())

fn local_io<'a>(&'a mut self) -> Option<LocalIo<'a>>

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

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

fn can_block(&self) -> bool

fn wrap(~self) -> ~Any