Skip to content

Blocking thread::sleep inside an async fn #64

Open
@hwchen

Description

@hwchen

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.

rust-lang/rust-clippy#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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions