When you wish to send a sequence of things across threads (in a thread-blocking way), you have e.g. crossbeam_channel
.
When you wish to send a sequence of things across futures (in a non-thread-blocking, future-blocking way), you have e.g. tokio::sync::mpsc
.
What would be something that enables me to send from a blocking thread, and receive from an asynchronous context ? (Btw, I could imagine needing the opposite at some point.)
I need the channel to be bounded, thread-blocking when sending and future-blocking when receiving.
I am looking for something somewhat performant, like an equivalent of what is done in crossbeam_channel
, but waking up the future instead of the thread, with the ability to buffer some messages to avoid blocking as much as possible. The answer given here for the multiple messages scenario looks a bit like a patch-up to that regard.