rust-lang / rust-lang/rust

Add mpsc select

Open
#135,437 2 comments 5 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

C-feature-request T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.