-
When using a let (sink, stream) = UdpFramed::new(...);
let sink_fut = spawn(async move {
loop {
sink.send(...).await;
sleep(Duration::from_millis(1500)).await;
}
});
let stream_fut = spawn(async move {
while let Some(item) = stream.next().await {
...
}
});
sink_fut.await;
stream_fut.await; The docs say that the stream task would cause starvation, but then say that "To account for this, Tokio has explicit yield points in a number of library functions, which force tasks to return to the executor periodically." I can't tell if I am doing something wrong or if |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
There is no problem in the code you have posted. Perhaps you removed the line with the problem when you simplified the example? |
Beta Was this translation helpful? Give feedback.
There is no problem in the code you have posted. Perhaps you removed the line with the problem when you simplified the example?