async-book
async-book copied to clipboard
Blocking `thread::sleep` inside an async fn
I've seen several async beginners try to use thread::sleep to try to wrap their brains around async. It's probably one of the most common ways to "see" async. I just want to make sure it's addressed in the async book. (I haven't read it, but at least one of the reddit threads was lifted from the book's join example).
There's also the possibility of a clippy lint, but beginners may not have gotten there yet.
https://github.com/rust-lang/rust-clippy/issues/4377
https://old.reddit.com/r/rust/comments/e1gxf8/not_understanding_asyncawait_properly/ https://old.reddit.com/r/rust/comments/dtp6z7/what_can_i_actually_do_with_the_new_async_fn/ https://old.reddit.com/r/rust/comments/dt0ruy/how_to_await_futures_concurrently/
Also I guess in the final tcp example async_std::fs should be used instead of std::fs