Skip to content

Commit 4d5c8bd

Browse files
Rollup merge of #135876 - usamoi:mpmc-doc, r=tgross35
fix doc for std::sync::mpmc fix document of `std::sync::mpmc` (tracked in #126840)
2 parents 314a695 + 0536423 commit 4d5c8bd

File tree

1 file changed

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

1 file changed

+12
-4
lines changed

Diff for: library/std/src/sync/mpmc/mod.rs

+12-4
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,17 @@ 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`]. However, if
364+
/// the channel is zero-capacity, it acts as a rendezvous channel and a
365+
/// return value of [`Ok`] means that the data has been received.
364366
///
365-
/// This method will never block the current thread.
367+
/// If the channel is full and not disconnected, this call will block until
368+
/// the send operation can proceed. If the channel becomes disconnected,
369+
/// this call will wake up and return an error. The returned error contains
370+
/// the original message.
371+
///
372+
/// If called on a zero-capacity channel, this method will wait for a receive
373+
/// operation to appear on the other side of the channel.
366374
///
367375
/// # Examples
368376
///
@@ -650,7 +658,7 @@ impl<T> fmt::Debug for Sender<T> {
650658
}
651659

652660
/// The receiving half of Rust's [`channel`] (or [`sync_channel`]) type.
653-
/// Different threads can share this [`Sender`] by cloning it.
661+
/// Different threads can share this [`Receiver`] by cloning it.
654662
///
655663
/// Messages sent to the channel can be retrieved using [`recv`].
656664
///

0 commit comments

Comments
 (0)