diff options
| author | bors <bors@rust-lang.org> | 2014-02-07 12:41:35 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-02-07 12:41:35 -0800 |
| commit | 7d7a060f8d95ee43406560e69a12631e52c617a7 (patch) | |
| tree | 5fda6ad0a7e3e684f5af4c49680ae2d25b395458 /src/libnative | |
| parent | 56565eb129018a708445afcd6ea14f5b51cf27e5 (diff) | |
| parent | 1508b6e953fd7f689a4ef7c0c01e989f942b695a (diff) | |
| download | rust-7d7a060f8d95ee43406560e69a12631e52c617a7.tar.gz rust-7d7a060f8d95ee43406560e69a12631e52c617a7.zip | |
auto merge of #12073 : alexcrichton/rust/doc-examples, r=cmr
"How do I start in libX" is a common question that I've seen, so I figured putting the examples in as many places as possible is probably a good idea.
Diffstat (limited to 'src/libnative')
| -rw-r--r-- | src/libnative/lib.rs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs index 1e4317af397..4840c561289 100644 --- a/src/libnative/lib.rs +++ b/src/libnative/lib.rs @@ -8,11 +8,38 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! The native runtime crate +//! The native I/O and threading crate //! //! This crate contains an implementation of 1:1 scheduling for a "native" //! runtime. In addition, all I/O provided by this crate is the thread blocking //! version of I/O. +//! +//! # Starting with libnative +//! +//! ```rust +//! extern mod native; +//! +//! #[start] +//! fn start(argc: int, argv: **u8) -> int { native::start(argc, argv, main) } +//! +//! fn main() { +//! // this code is running on the main OS thread +//! } +//! ``` +//! +//! # Force spawning a native task +//! +//! ```rust +//! extern mod native; +//! +//! fn main() { +//! // We're not sure whether this main function is run in 1:1 or M:N mode. +//! +//! native::task::spawn(proc() { +//! // this code is guaranteed to be run on a native thread +//! }); +//! } +//! ``` #[crate_id = "native#0.10-pre"]; #[license = "MIT/ASL2"]; |
