docs(ch21-03): clarify channel state after sender drop (#4673)#4781
Open
Dodothereal wants to merge 1 commit into
Open
docs(ch21-03): clarify channel state after sender drop (#4673)#4781Dodothereal wants to merge 1 commit into
Dodothereal wants to merge 1 commit into
Conversation
Fixes rust-lang#4673: 'When that happens' on its own doesn't distinguish between the buffered-message-still-drainable state and the sender-disconnected + buffer-empty state of mpsc channels. After drop(sender), workers can still recv() messages already in the queue; only when the buffer empties do recv() calls start returning Err. Replaced the single 'When that happens' with two clarifying sentences so the explanation lines up with the observed output in the graceful-shutdown run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4673
Summary
In ch21-03, 'When that happens' immediately presupposes that
dropping the sender forces recv() to error, but mpsc channels can
still drain messages already buffered after the sender is dropped.
The discrete observation in the issue is that sample
graceful-shutdown output shows a worker still receiving a job after
the 'Shutting down worker N' message — consistent with buffering.
Add two short sentences flagging the buffered state. No code or
listing changed.
Test plan
AI assistance
Prepared with help from an AI coding assistant; reviewed end-to-end.