Skip to content

Commit 23bf892

Browse files
committed
core::rt: Improve docs
1 parent 93ca5eb commit 23bf892

File tree

1 file changed

+57
-8
lines changed

1 file changed

+57
-8
lines changed

src/libcore/rt/mod.rs

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
/*! The Rust runtime, including the scheduler and I/O interface
11+
/*! Rust runtime services, including the task scheduler and I/O interface
1212
1313
# XXX
1414
1515
* Unsafe uses of borrowed pointers should just use unsafe pointers
16-
* Unwinding is not wired up correctly
1716
1817
*/
1918

@@ -22,29 +21,76 @@
2221

2322
use libc::c_char;
2423

24+
/// The Scheduler and Task types, and thread-local access thereof
2525
#[path = "sched/mod.rs"]
2626
mod sched;
27-
pub mod rtio;
28-
pub mod uvll;
29-
mod uvio;
27+
28+
/// Synchronous I/O
29+
#[path = "io/mod.rs"]
30+
pub mod io;
31+
32+
/// Thread-local implementations of language-critical runtime features like @
33+
pub mod local_services;
34+
35+
/// The EventLoop and internal synchronous I/O interface, dynamically
36+
/// overridable so that it's primary implementation on libuv can
37+
/// live outside of core.
38+
mod rtio;
39+
40+
/// libuv
3041
#[path = "uv/mod.rs"]
3142
mod uv;
32-
#[path = "io/mod.rs"]
33-
mod io;
43+
44+
/// The implementation of `rtio` for libuv
45+
mod uvio;
46+
47+
/// C bindings to libuv
48+
pub mod uvll;
49+
50+
3451
// FIXME #5248: The import in `sched` doesn't resolve unless this is pub!
52+
/// Bindings to pthread/windows thread-local storage
3553
pub mod thread_local_storage;
54+
55+
/// A parallel work-stealing queue
3656
mod work_queue;
57+
58+
/// Stack segments and their cacheing
3759
mod stack;
60+
61+
/// CPU context swapping
3862
mod context;
63+
64+
/// Bindings to system threading libraries
3965
mod thread;
66+
67+
/// The runtime configuration, read from environment variables
4068
pub mod env;
41-
pub mod local_services;
69+
70+
/// The local, managed heap
4271
mod local_heap;
4372

4473
/// Tools for testing the runtime
4574
#[cfg(test)]
4675
pub mod test;
4776

77+
/// Set up a default runtime configuration, given compiler-supplied arguments.
78+
///
79+
/// This is invoked by the `start` _language item_ (unstable::lang) to
80+
/// run a Rust executable.
81+
///
82+
/// # Arguments
83+
///
84+
/// * `main` - A C-abi function that takes no arguments and returns `c_void`.
85+
/// It is a wrapper around the user-defined `main` function, and will be run
86+
/// in a task.
87+
/// * `argc` & `argv` - The argument vector. On Unix this information is used
88+
/// by os::args.
89+
/// * `crate_map` - Runtime information about the executing crate, mostly for logging
90+
///
91+
/// # Return value
92+
///
93+
/// The return value is used as the process return code. 0 on success, 101 on error.
4894
pub fn start(main: *u8, _argc: int, _argv: **c_char, _crate_map: *u8) -> int {
4995

5096
use self::sched::{Scheduler, Task};
@@ -79,6 +125,8 @@ pub fn start(main: *u8, _argc: int, _argv: **c_char, _crate_map: *u8) -> int {
79125

80126
/// Possible contexts in which Rust code may be executing.
81127
/// Different runtime services are available depending on context.
128+
/// Mostly used for determining if we're using the new scheduler
129+
/// or the old scheduler.
82130
#[deriving(Eq)]
83131
pub enum RuntimeContext {
84132
// Only the exchange heap is available
@@ -91,6 +139,7 @@ pub enum RuntimeContext {
91139
OldTaskContext
92140
}
93141

142+
/// Determine the current RuntimeContext
94143
pub fn context() -> RuntimeContext {
95144

96145
use task::rt::rust_task;

0 commit comments

Comments
 (0)