Skip to content

Commit ca9879c

Browse files
committed
fix doc for std::sync::mpmc
1 parent b2728d5 commit ca9879c

File tree

1 file changed

+13
-4
lines changed
  • library/std/src/sync/mpmc

1 file changed

+13
-4
lines changed

library/std/src/sync/mpmc/mod.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//! infinite buffer.
1919
//!
2020
//! 2. A synchronous, bounded channel. The [`sync_channel`] function will
21-
//! return a `(SyncSender, Receiver)` tuple where the storage for pending
21+
//! return a `(Sender, Receiver)` tuple where the storage for pending
2222
//! messages is a pre-allocated buffer of a fixed size. All sends will be
2323
//! **synchronous** by blocking until there is buffer space available. Note
2424
//! that a bound of 0 is allowed, causing the channel to become a "rendezvous"
@@ -360,9 +360,18 @@ impl<T> Sender<T> {
360360
/// that a return value of [`Err`] means that the data will never be
361361
/// received, but a return value of [`Ok`] does *not* mean that the data
362362
/// will be received. It is possible for the corresponding receiver to
363-
/// hang up immediately after this function returns [`Ok`].
363+
/// hang up immediately after this function returns [`Ok`]. If the channel
364+
/// is zero-capacity, however, the channel becomes a rendezvous channel and
365+
/// it guarantees that the receiver has indeed received the data if this
366+
/// function returns success.
364367
///
365-
/// This method will never block the current thread.
368+
/// If the channel is full and not disconnected, this call will block until
369+
/// the send operation can proceed. If the channel becomes disconnected,
370+
/// this call will wake up and return an error. The returned error contains
371+
/// the original message.
372+
///
373+
/// If called on a zero-capacity channel, this method will wait for a receive
374+
/// operation to appear on the other side of the channel.
366375
///
367376
/// # Examples
368377
///
@@ -650,7 +659,7 @@ impl<T> fmt::Debug for Sender<T> {
650659
}
651660

652661
/// The receiving half of Rust's [`channel`] (or [`sync_channel`]) type.
653-
/// Different threads can share this [`Sender`] by cloning it.
662+
/// Different threads can share this [`Receiver`] by cloning it.
654663
///
655664
/// Messages sent to the channel can be retrieved using [`recv`].
656665
///

0 commit comments

Comments
 (0)