Skip to content

Commit 4cf5930

Browse files
committed
Remove incorrect example from docs
1 parent b41f2df commit 4cf5930

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

src/libstd/sync/mpsc/mod.rs

-26
Original file line numberDiff line numberDiff line change
@@ -113,32 +113,6 @@
113113
//! rx.recv().unwrap();
114114
//! ```
115115
//!
116-
//! Reading from a channel with a timeout requires to use a Timer together
117-
//! with the channel. You can use the `select!` macro to select either and
118-
//! handle the timeout case. This first example will break out of the loop
119-
//! after 10 seconds no matter what:
120-
//!
121-
//! ```no_run
122-
//! # #![feature(std_misc, old_io)]
123-
//! use std::sync::mpsc::channel;
124-
//! use std::old_io::timer::Timer;
125-
//! use std::time::Duration;
126-
//!
127-
//! let (tx, rx) = channel::<i32>();
128-
//! let mut timer = Timer::new().unwrap();
129-
//! let timeout = timer.oneshot(Duration::seconds(10));
130-
//!
131-
//! loop {
132-
//! select! {
133-
//! val = rx.recv() => println!("Received {}", val.unwrap()),
134-
//! _ = timeout.recv() => {
135-
//! println!("timed out, total time was more than 10 seconds");
136-
//! break;
137-
//! }
138-
//! }
139-
//! }
140-
//! ```
141-
//!
142116
//! This second example is more costly since it allocates a new timer every
143117
//! time a message is received, but it allows you to timeout after the channel
144118
//! has been inactive for 5 seconds:

0 commit comments

Comments
 (0)