about summary refs log tree commit diff
path: root/src/libstd/sync/mpsc
diff options
context:
space:
mode:
authorFelix Rabe <felix@rabe.io>2018-08-07 16:35:03 +0200
committerGitHub <noreply@github.com>2018-08-07 16:35:03 +0200
commitb1f47aa8380c8dbe7fbd2d96d685cd1f28cc1a6d (patch)
tree7634047dc023b7f9728dd8c68e946b772e8b4516 /src/libstd/sync/mpsc
parentc3fdd19e43e0e0ecb7d12e15b0892dbe6139798d (diff)
downloadrust-b1f47aa8380c8dbe7fbd2d96d685cd1f28cc1a6d.tar.gz
rust-b1f47aa8380c8dbe7fbd2d96d685cd1f28cc1a6d.zip
Document panic in mpsc::Receiver::recv_timeout
Diffstat (limited to 'src/libstd/sync/mpsc')
-rw-r--r--src/libstd/sync/mpsc/mod.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs
index fc0e37f150e..e82f40ff96f 100644
--- a/src/libstd/sync/mpsc/mod.rs
+++ b/src/libstd/sync/mpsc/mod.rs
@@ -1249,7 +1249,29 @@ impl<T> Receiver<T> {
     ///
     /// # Panics
     ///
-    /// Panics due to a known issue ([`#39364`][]).
+    /// There is currently a known issue with this function ([`#39364`]) that
+    /// causes `recv_timeout` to panic unexpectedly with the following example:
+    ///
+    /// ```no_run
+    /// use std::sync::mpsc::channel;
+    /// use std::thread;
+    /// use std::time::Duration;
+    /// 
+    /// let (tx, rx) = channel::<String>();
+    ///
+    /// thread::spawn(move || {
+    ///     let d = Duration::from_millis(10);
+    ///     loop {
+    ///         println!("recv");
+    ///         let _r = rx.recv_timeout(d);
+    ///     }
+    /// });
+    ///
+    /// thread::sleep(Duration::from_millis(100));
+    /// let _c1 = tx.clone();
+    ///
+    /// thread::sleep(Duration::from_secs(1));
+    /// ```
     ///
     /// [`#39364`]: https://github.com/rust-lang/rust/issues/39364
     ///