Skip to content

Commit c9a77d0

Browse files
committed
auto merge of #15576 : mrmonday/rust/patch-1, r=alexcrichton
Add a couple of lines mentioning event_loop_factory - no clear error message is given if you attempt to perform I/O in tasks created in this fashion. I spent a many hours debugging this yesterday which would have been avoided if it were documented.
2 parents ca56650 + b5dd258 commit c9a77d0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/libgreen/lib.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,18 @@
164164
//! possibly pinned to a particular scheduler thread:
165165
//!
166166
//! ```rust
167+
//! extern crate green;
168+
//! extern crate rustuv;
169+
//!
170+
//! # fn main() {
167171
//! use std::task::TaskBuilder;
168172
//! use green::{SchedPool, PoolConfig, GreenTaskBuilder};
169173
//!
170-
//! let config = PoolConfig::new();
174+
//! let mut config = PoolConfig::new();
175+
//!
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+
//!
171179
//! let mut pool = SchedPool::new(config);
172180
//!
173181
//! // Spawn tasks into the pool of schedulers
@@ -195,6 +203,7 @@
195203
//! // Required to shut down this scheduler pool.
196204
//! // The task will fail if `shutdown` is not called.
197205
//! pool.shutdown();
206+
//! # }
198207
//! ```
199208
200209
#![crate_name = "green"]

0 commit comments

Comments
 (0)