mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-13 17:13:48 +00:00
Remove another invalid example
This commit is contained in:
parent
4cf59304c1
commit
4695bf0705
@ -112,32 +112,6 @@
|
||||
//! });
|
||||
//! rx.recv().unwrap();
|
||||
//! ```
|
||||
//!
|
||||
//! This second example is more costly since it allocates a new timer every
|
||||
//! time a message is received, but it allows you to timeout after the channel
|
||||
//! has been inactive for 5 seconds:
|
||||
//!
|
||||
//! ```no_run
|
||||
//! # #![feature(std_misc, old_io)]
|
||||
//! use std::sync::mpsc::channel;
|
||||
//! use std::old_io::timer::Timer;
|
||||
//! use std::time::Duration;
|
||||
//!
|
||||
//! let (tx, rx) = channel::<i32>();
|
||||
//! let mut timer = Timer::new().unwrap();
|
||||
//!
|
||||
//! loop {
|
||||
//! let timeout = timer.oneshot(Duration::seconds(5));
|
||||
//!
|
||||
//! select! {
|
||||
//! val = rx.recv() => println!("Received {}", val.unwrap()),
|
||||
//! _ = timeout.recv() => {
|
||||
//! println!("timed out, no message received in 5 seconds");
|
||||
//! break;
|
||||
//! }
|
||||
//! }
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user