|
30 | 30 | //! method is ready when a new, *unseen* value is sent via the [`Sender`] half.
|
31 | 31 | //!
|
32 | 32 | //! * [`Receiver::changed()`] returns `Ok(())` on receiving a new value, or
|
33 |
| -//! `Err(`[`error::RecvError`]`)` if the [`Sender`] has been dropped. |
| 33 | +//! `Err(`[`error::RecvError`]`)` if all [`Sender`]s have been dropped. |
34 | 34 | //! * If the current value is *unseen* when calling [`changed`], then
|
35 | 35 | //! [`changed`] will return immediately. If the current value is *seen*, then
|
36 | 36 | //! it will sleep until either a new message is sent via the [`Sender`] half,
|
|
90 | 90 | //! when all [`Receiver`] handles have been dropped. This indicates that there
|
91 | 91 | //! is no further interest in the values being produced and work can be stopped.
|
92 | 92 | //!
|
93 |
| -//! The value in the channel will not be dropped until the sender and all |
| 93 | +//! The value in the channel will not be dropped until all senders and all |
94 | 94 | //! receivers have been dropped.
|
95 | 95 | //!
|
96 | 96 | //! # Thread safety
|
@@ -391,7 +391,7 @@ mod state {
|
391 | 391 | /// Snapshot of the state. The first bit is used as the CLOSED bit.
|
392 | 392 | /// The remaining bits are used as the version.
|
393 | 393 | ///
|
394 |
| - /// The CLOSED bit tracks whether the Sender has been dropped. Dropping all |
| 394 | + /// The CLOSED bit tracks whether all senders have been dropped. Dropping all |
395 | 395 | /// receivers does not set it.
|
396 | 396 | #[derive(Copy, Clone, Debug)]
|
397 | 397 | pub(super) struct StateSnapshot(usize);
|
@@ -670,7 +670,7 @@ impl<T> Receiver<T> {
|
670 | 670 | // Load the version from the state
|
671 | 671 | let state = self.shared.state.load();
|
672 | 672 | if state.is_closed() {
|
673 |
| - // The sender has dropped. |
| 673 | + // All senders have dropped. |
674 | 674 | return Err(error::RecvError(()));
|
675 | 675 | }
|
676 | 676 | let new_version = state.version();
|
@@ -706,10 +706,10 @@ impl<T> Receiver<T> {
|
706 | 706 | /// If the newest value in the channel has not yet been marked seen when
|
707 | 707 | /// this method is called, the method marks that value seen and returns
|
708 | 708 | /// immediately. If the newest value has already been marked seen, then the
|
709 |
| - /// method sleeps until a new message is sent by the [`Sender`] connected to |
710 |
| - /// this `Receiver`, or until the [`Sender`] is dropped. |
| 709 | + /// method sleeps until a new message is sent by a [`Sender`] connected to |
| 710 | + /// this `Receiver`, or until all [`Sender`]s are dropped. |
711 | 711 | ///
|
712 |
| - /// This method returns an error if and only if the [`Sender`] is dropped. |
| 712 | + /// This method returns an error if and only if all [`Sender`]s are dropped. |
713 | 713 | ///
|
714 | 714 | /// For more information, see
|
715 | 715 | /// [*Change notifications*](self#change-notifications) in the module-level documentation.
|
@@ -901,7 +901,7 @@ fn maybe_changed<T>(
|
901 | 901 | }
|
902 | 902 |
|
903 | 903 | if state.is_closed() {
|
904 |
| - // The sender has been dropped. |
| 904 | + // All senders have been dropped. |
905 | 905 | return Some(Err(error::RecvError(())));
|
906 | 906 | }
|
907 | 907 |
|
|
0 commit comments