Skip to content

Conversation

@connortsui20
Copy link
Contributor

Tracking Issue: #143674

Adds a is_ready method to the oneshot::Receiver.

This also changes the internal mutex for the mpmc::zero flavor implementation to use the nonpoison::Mutex since every lock call simply unwraps. Please let me know if that is out of the scope of this change.

There's also one small unfortunate implementation detail, see comments below.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Adds an `is_ready` method to `oneshot::Receiver` that allows a user to
see if a value has been sent over the channel.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 12, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2026

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, joboet

Comment on lines +283 to +286
/// Returns `true` when the channel is disconnected.
pub(crate) fn is_disconnected(&self) -> bool {
self.inner.lock().is_disconnected
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's somewhat unfortunate that this has to take the lock. I believe it might be possible to outline the is_disconnected flag as an atomic bool outside of the lock, but that might not be worth the extra complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants