Hi.
I need a ( Multi-Producer, Multi_Consumer ) channel but tokio have mpsc.
I read a article that shared tokio::receiver inside Arc<Mutex>
but I search and found async_channel crate is recommended for mpmc.
Which is better ??!
Hi.
I need a ( Multi-Producer, Multi_Consumer ) channel but tokio have mpsc.
I read a article that shared tokio::receiver inside Arc<Mutex>
but I search and found async_channel crate is recommended for mpmc.
Which is better ??!
I would take a look at the crossbeam library. They have some structures that can work for multiple consumers.
See crossbeam - Rust
Thanks but i need Async channel, crossbeam is sync if i don't wrong
Another crate to look at is the crossfire crate, which has
async -> async
async -> sync
sync -> async
mpmc channels based off of crossbeams channels.
Tokio maintainer here. If you need an mpmc channel, then use async-channel
. That is definitely better than an Arc<Mutex<mpsc::Receiver<T>>>
.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.