Future streams in Localpool starving

Hi
In an example code with a LocalPool executor running two async functions.
Each async function looks something like

async fn xyz() {
    let stream = ....
    loop {
        stream.next().await;
        ....
    }
}

If one stream always return Poll:Ready, the other will starve, even if ready. I would expect them to round robin. Is this by design or a flaw?
Cheers!

If one stream is always ready, then the future just keeps running. The choice of executor doesn't have anything to do with it. You could write a little future that "yields" back to the executor by returning Pending once and then Ready to cooperatively allow other futures to run and call that periodically. Tokio has one, but it's not runtime specific so that could easily move to the futures crate: https://docs.rs/tokio/0.2.2/src/tokio/task/yield_now.rs.html#6-27

Thanks for the quick reply! That looks like a neat solution, I'll give it a try :slight_smile: