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

Add a mpmc channel #848

Closed
steveklabnik opened this issue Feb 14, 2015 · 19 comments
Closed

Add a mpmc channel #848

steveklabnik opened this issue Feb 14, 2015 · 19 comments
Labels
A-community-library Area: The RFC is related to a community library. T-libs-api Relevant to the library API team, which will review and decide on the RFC.

Comments

@steveklabnik
Copy link
Member

Issue by mahkoh
Friday Dec 12, 2014 at 20:26 GMT

For earlier discussion, see rust-lang/rust#19783

This issue was labelled with: A-libs, A-threads in the Rust repository


@steveklabnik steveklabnik added A-community-library Area: The RFC is related to a community library. A-libs labels Feb 14, 2015
@steveklabnik
Copy link
Member Author

@jonhoo
Copy link
Contributor

jonhoo commented Jun 3, 2015

FWIW, a spmc channel would also be incredibly useful, and could probably be optimized in ways a mpmc can not.

@viperscape
Copy link

@jonhoo I started bulding a spmc lib for rust, though it needs optimizations, and I should probably dump the linked list idea.. oyashio/spmc lib

@19h
Copy link

19h commented Aug 25, 2016

Any updates on this? :-)

@jonhoo
Copy link
Contributor

jonhoo commented Aug 25, 2016

https://github.com/jonhoo/bus could probably be adapted pretty easily to be spmc instead of sp-broadcast. Will probably simplify the code a fair amount in fact.

@eddyb
Copy link
Member

eddyb commented Aug 25, 2016

I believe crossbeam's SegQueue is a MPMC channel.
EDIT: SegQueue is non-blocking, but MsQueue looks more like a channel.

@jadbox
Copy link

jadbox commented Apr 27, 2017

Any update on getting this into Rust core?

@aperrot42
Copy link

Would definitely be a useful feature. Is it to be integrated to rust 's sync library ?

@petrochenkov petrochenkov added T-libs-api Relevant to the library API team, which will review and decide on the RFC. and removed A-libs labels Jan 29, 2018
@WiSaGaN
Copy link
Contributor

WiSaGaN commented Aug 15, 2018

I believe crossbeam-channel has become the community preferred MPMC channel this year.

@Centril
Copy link
Contributor

Centril commented Aug 15, 2018

@WiSaGaN thanks for the update. Closing this therefore.

@Centril Centril closed this as completed Aug 15, 2018
@let4be
Copy link

let4be commented Mar 18, 2021

What about crossbeam-channel and tokio? Does it work with it or does it work with std threads only?...

@Kixiron
Copy link
Member

Kixiron commented Mar 18, 2021

That's a question for crossbeam, not really a rust rfc

@aWeinzierl
Copy link

@Centril I don't quite understand? How does this solve this issue? 🤔

@RustyYato
Copy link

Use crossbeam, using dependencies in Rust is easy and painless. So if something can be a dep instead of in std, putting it in a dep is preferred.

@Sebi2020
Copy link

Sebi2020 commented Aug 2, 2021

Mh, should definitly work without dependencies...

@LunarLambda
Copy link

Hello from 2024. Since std's mpsc channels are nowadays based on a mpmc channel (whose implementation is in turn based on crossbeam), is there any possibility of reviving this idea? Apologies for replying to a years old closed issue but this is the only/most recent mention of this topic. The impl !Sync for Receiver<T> (https://doc.rust-lang.org/stable/src/std/sync/mpsc/mod.rs.html#194) does not specify a reason so I assume there's nothing technical stopping this.

I assume this is mainly a naming churn problem, since we can't rename the mpsc module to mpmc, and it would be weird to expose the exact same types through a second module based on a 'semantic' change.

Ultimately I'd love to have this in standard Rust, since it already exists in std anyway, but I'm curious to know what would need to be done to make this happen (besides the obvious 'make an RFC'), what kind of approach would be deemed possible and preferred by the libs team.

@rmnilin
Copy link

rmnilin commented May 25, 2024

@Centril @eddyb @jonhoo @Kixiron @WiSaGaN, apologies for the ping, but could we please consider reopening this issue?

I believe that LunarLambda has made excellent points that warrant further comments at least.

The closure of this RFC based on the existence of third-party libraries overlooks the benefits of having this capability integrated into the standard library, especially accessibility, consistent maintenance, and reduced dependency overhead.

Given these points, I believe there is a strong case for revisiting this RFC. Having MPMC channels in the standard library would greatly enhance Rust's concurrency primitives and provide a more robust solution for concurrent programming.

Thank you in advance for considering this request.

@steveklabnik
Copy link
Member Author

@rmnilin issues in the RFC repo are mostly just a place for folks interested in an idea to talk about it. It being open or closed says nothing about the actual state of this. they're not used in any decision making process by the teams.

pull requests are "actual" RFCs that are being actively developed. anyone interested in moving a proposal forward would write an RFC and open a pull request with the RFC itself.

@shepmaster
Copy link
Member

Note that the libs team is generally positive to adding this. Someone needs to do the work, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-community-library Area: The RFC is related to a community library. T-libs-api Relevant to the library API team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests