Module std::rtUnstable[src]

Runtime services, including the task scheduler and I/O dispatcher

The rt module provides the private runtime infrastructure necessary to support core language features like the exchange and local heap, the garbage collector, logging, local data and unwinding. It also implements the default task scheduler and task model. Initialization routines are provided for setting up runtime resources in common configurations, including that used by rustc when generating executables.

It is intended that the features provided by rt can be factored in a way such that the core library can be built with different 'profiles' for different use cases, e.g. excluding the task scheduler. A number of runtime features though are critical to the functioning of the language and an implementation must be provided regardless of the execution environment.

Of foremost importance is the global exchange heap, in the module heap. Very little practical Rust code can be written without access to the global heap. Unlike most of rt the global heap is truly a global resource and generally operates independently of the rest of the runtime.

All other runtime features are task-local, including the local heap, the garbage collector, local storage, logging and the stack unwinder.

The relationship between rt and the rest of the core library is not entirely clear yet and some modules will be moving into or out of rt as development proceeds.

Several modules in core are clients of rt:

Modules

args

Global storage for command line arguments

backtrace

Simple backtrace functionality (to print on failure)

bookkeeping

Task bookkeeping

exclusive
heap
libc_heap

The global (exchange) heap.

local
mutex

A native mutex and condition variable type.

rtio

The EventLoop and internal synchronous I/O interface.

stack

Rust stack-limit management

task

Language-level runtime services that should reasonably expected to be available 'everywhere'. Local heaps, GC, unwinding, local storage, and logging. Even a 'freestanding' Rust would likely want to implement this.

thread

Native os-thread management

unwind

Implementation of Rust stack unwinding

Structs

Stdio

Statics

pub static DEFAULT_ERROR_CODE: int = [definition]  
pub static Stderr: Stdio = [definition]  
pub static Stdout: Stdio = [definition]  

Traits

Runtime

The interface to the current runtime.

Functions

at_exit

Enqueues a procedure to run when the runtime is cleaned up

begin_unwind

This is the entry point of unwinding for fail!() and assert!().

begin_unwind_fmt

The entry point for unwinding with a formatted message.

cleanup

One-time runtime cleanup.

default_sched_threads

Get's the number of scheduler threads requested by the environment either RUST_THREADS or num_cpus.

init

One-time runtime initialization.

min_stack
running_on_valgrind

Dynamically inquire about whether we're running under V. You should usually not use this unless your test definitely can't run correctly un-altered. Valgrind is there to help you notice weirdness in normal, un-doctored code paths!