8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- /*! The Rust runtime, including the scheduler and I/O interface
11
+ /*! Rust runtime services , including the task scheduler and I/O interface
12
12
13
13
# XXX
14
14
15
15
* Unsafe uses of borrowed pointers should just use unsafe pointers
16
- * Unwinding is not wired up correctly
17
16
18
17
*/
19
18
22
21
23
22
use libc:: c_char;
24
23
24
+ /// The Scheduler and Task types, and thread-local access thereof
25
25
#[ path = "sched/mod.rs" ]
26
26
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
30
41
#[ path = "uv/mod.rs" ]
31
42
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
+
34
51
// FIXME #5248: The import in `sched` doesn't resolve unless this is pub!
52
+ /// Bindings to pthread/windows thread-local storage
35
53
pub mod thread_local_storage;
54
+
55
+ /// A parallel work-stealing queue
36
56
mod work_queue;
57
+
58
+ /// Stack segments and their cacheing
37
59
mod stack;
60
+
61
+ /// CPU context swapping
38
62
mod context;
63
+
64
+ /// Bindings to system threading libraries
39
65
mod thread;
66
+
67
+ /// The runtime configuration, read from environment variables
40
68
pub mod env;
41
- pub mod local_services;
69
+
70
+ /// The local, managed heap
42
71
mod local_heap;
43
72
44
73
/// Tools for testing the runtime
45
74
#[ cfg( test) ]
46
75
pub mod test;
47
76
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.
48
94
pub fn start ( main : * u8 , _argc : int , _argv : * * c_char , _crate_map : * u8 ) -> int {
49
95
50
96
use self :: sched:: { Scheduler , Task } ;
@@ -79,6 +125,8 @@ pub fn start(main: *u8, _argc: int, _argv: **c_char, _crate_map: *u8) -> int {
79
125
80
126
/// Possible contexts in which Rust code may be executing.
81
127
/// 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.
82
130
#[ deriving( Eq ) ]
83
131
pub enum RuntimeContext {
84
132
// Only the exchange heap is available
@@ -91,6 +139,7 @@ pub enum RuntimeContext {
91
139
OldTaskContext
92
140
}
93
141
142
+ /// Determine the current RuntimeContext
94
143
pub fn context ( ) -> RuntimeContext {
95
144
96
145
use task:: rt:: rust_task;
0 commit comments