Skip to content

Commit e3553a3

Browse files
committed
---
yaml --- r: 109373 b: refs/heads/dist-snap c: e2ae458 h: refs/heads/master i: 109371: e8df51a v: v3
1 parent 9c884f3 commit e3553a3

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 3ccad75641515b1fa62dc5378b0b139129aa9daf
9+
refs/heads/dist-snap: e2ae4585481879290879e46881916ce6e3dd22c1
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/doc/guide-runtime.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,27 +223,49 @@ Having a default decision made in the compiler is done out of necessity and
223223
convenience. The compiler's decision of runtime to link to is *not* an
224224
endorsement of one over the other. As always, this decision can be overridden.
225225

226-
For example, this program will be linked to "the default runtime"
226+
For example, this program will be linked to "the default runtime". The current
227+
default runtime is to use libnative.
227228

228229
~~~{.rust}
229230
fn main() {}
230231
~~~
231232

232-
Whereas this program explicitly opts into using a particular runtime
233+
### Force booting with libgreen
234+
235+
In this example, the `main` function will be booted with I/O support powered by
236+
libuv. This is done by linking to the `rustuv` crate and specifying the
237+
`rustuv::event_loop` function as the event loop factory.
238+
239+
To create a pool of green tasks which have no I/O support, you may shed the
240+
`rustuv` dependency and use the `green::basic::event_loop` function instead of
241+
`rustuv::event_loop`. All tasks will have no I/O support, but they will still be
242+
able to deschedule/reschedule (use channels, locks, etc).
233243

234244
~~~{.rust}
235245
extern crate green;
246+
extern crate rustuv;
236247
237248
#[start]
238249
fn start(argc: int, argv: **u8) -> int {
239-
green::start(argc, argv, main)
250+
green::start(argc, argv, rustuv::event_loop, main)
240251
}
241252
242253
fn main() {}
243254
~~~
244255

245-
Both libgreen/libnative provide a top-level `start` function which is used to
246-
boot an initial Rust task in that specified runtime.
256+
### Force booting with libnative
257+
258+
This program's `main` function will always be booted with libnative, running
259+
inside of an OS thread.
260+
261+
~~~{.rust}
262+
extern crate native;
263+
264+
#[start]
265+
fn start(argc: int, argv: **u8) -> int { native::start(argc, argv, main) }
266+
267+
fn main() {}
268+
~~~
247269

248270
# Finding the runtime
249271

0 commit comments

Comments
 (0)