|
128 | 128 | //! > **Note**: This `main` function in this example does *not* have I/O |
129 | 129 | //! > support. The basic event loop does not provide any support |
130 | 130 | //! |
131 | | -//! # Starting with I/O support in libgreen |
132 | | -//! |
133 | | -//! ```rust |
134 | | -//! extern crate green; |
135 | | -//! extern crate rustuv; |
136 | | -//! |
137 | | -//! #[start] |
138 | | -//! fn start(argc: int, argv: *const *const u8) -> int { |
139 | | -//! green::start(argc, argv, rustuv::event_loop, main) |
140 | | -//! } |
141 | | -//! |
142 | | -//! fn main() { |
143 | | -//! // this code is running in a pool of schedulers all powered by libuv |
144 | | -//! } |
145 | | -//! ``` |
146 | | -//! |
147 | | -//! The above code can also be shortened with a macro from libgreen. |
148 | | -//! |
149 | | -//! ``` |
150 | | -//! #![feature(phase)] |
151 | | -//! #[phase(plugin)] extern crate green; |
152 | | -//! |
153 | | -//! green_start!(main) |
154 | | -//! |
155 | | -//! fn main() { |
156 | | -//! // run inside of a green pool |
157 | | -//! } |
158 | | -//! ``` |
159 | | -//! |
160 | 131 | //! # Using a scheduler pool |
161 | 132 | //! |
162 | 133 | //! This library adds a `GreenTaskBuilder` trait that extends the methods |
|
165 | 136 | //! |
166 | 137 | //! ```rust |
167 | 138 | //! extern crate green; |
168 | | -//! extern crate rustuv; |
169 | 139 | //! |
170 | 140 | //! # fn main() { |
171 | 141 | //! use std::task::TaskBuilder; |
172 | 142 | //! use green::{SchedPool, PoolConfig, GreenTaskBuilder}; |
173 | 143 | //! |
174 | 144 | //! let mut config = PoolConfig::new(); |
175 | 145 | //! |
176 | | -//! // Optional: Set the event loop to be rustuv's to allow I/O to work |
177 | | -//! config.event_loop_factory = rustuv::event_loop; |
178 | | -//! |
179 | 146 | //! let mut pool = SchedPool::new(config); |
180 | 147 | //! |
181 | 148 | //! // Spawn tasks into the pool of schedulers |
|
221 | 188 | #![allow(deprecated)] |
222 | 189 |
|
223 | 190 | #[cfg(test)] #[phase(plugin, link)] extern crate log; |
224 | | -#[cfg(test)] extern crate rustuv; |
225 | 191 | extern crate libc; |
226 | 192 | extern crate alloc; |
227 | 193 |
|
@@ -253,33 +219,6 @@ pub mod sleeper_list; |
253 | 219 | pub mod stack; |
254 | 220 | pub mod task; |
255 | 221 |
|
256 | | -/// A helper macro for booting a program with libgreen |
257 | | -/// |
258 | | -/// # Example |
259 | | -/// |
260 | | -/// ``` |
261 | | -/// #![feature(phase)] |
262 | | -/// #[phase(plugin)] extern crate green; |
263 | | -/// |
264 | | -/// green_start!(main) |
265 | | -/// |
266 | | -/// fn main() { |
267 | | -/// // running with libgreen |
268 | | -/// } |
269 | | -/// ``` |
270 | | -#[macro_export] |
271 | | -macro_rules! green_start( ($f:ident) => ( |
272 | | - mod __start { |
273 | | - extern crate green; |
274 | | - extern crate rustuv; |
275 | | - |
276 | | - #[start] |
277 | | - fn start(argc: int, argv: *const *const u8) -> int { |
278 | | - green::start(argc, argv, rustuv::event_loop, super::$f) |
279 | | - } |
280 | | - } |
281 | | -) ) |
282 | | - |
283 | 222 | /// Set up a default runtime configuration, given compiler-supplied arguments. |
284 | 223 | /// |
285 | 224 | /// This function will block until the entire pool of M:N schedulers have |
|
0 commit comments