Skip to content

Add mpsc select #135437

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

Open
Timmmm opened this issue Jan 13, 2025 · 2 comments
Open

Add mpsc select #135437

Timmmm opened this issue Jan 13, 2025 · 2 comments
Assignees
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Timmmm
Copy link
Contributor

Timmmm commented Jan 13, 2025

Rust has nice implementations of channels, but is missing an implementation of select (i.e. wait on multiple channels), which severely limits their usefulness.

The usual solution is to give up on std::sync::mpsc::channel entirely and use crossbeam-channel instead. That's rather unfortunate - it's like providing a file API, but there's no write functionality so you have to use a third party crate for all file operations instead.

Years ago there was an unstable implementation, but it was removed in 2019 without ever being stabilised (the implementation was apparently unsafe and had other issues - see #27800).

However since 2022, std::sync::mpsc::channel has been implemented in terms of crossbeam-channel, which makes it even more weird that you still have to use crossbeam-channel, and also presumably means that importing crossbeam-channel's select implementation is much easier.

Could we do that?

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 13, 2025
@fmease fmease added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-feature-request Category: A feature request, i.e: not implemented / a PR. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 13, 2025
@krishpranav

This comment was marked as spam.

@krishpranav

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants