Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document why we notify all streams when sending a single message #57

Open
Ten0 opened this issue Feb 12, 2023 · 0 comments
Open

Document why we notify all streams when sending a single message #57

Ten0 opened this issue Feb 12, 2023 · 0 comments

Comments

@Ten0
Copy link

Ten0 commented Feb 12, 2023

async-channel/src/lib.rs

Lines 204 to 208 in a0ba218

// it will notify another blocked receive operation.
self.channel.recv_ops.notify_additional(1);
// Notify all blocked streams.
self.channel.stream_ops.notify(usize::MAX);

It's unclear to me why all streams are woken up instead of a single one when sending a message. (That is, why don't streams and recv behave in the same way, when the stream is typically essentially "polling recv forever").

Would it be possible to document that further?

Thanks,

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

No branches or pull requests

1 participant