Skip to content

Why doesn't detach force running a task to its first await point? #298

Closed Answered by notgull
cr1901 asked this question in Q&A
Discussion options

You must be logged in to vote

Tasks do not run except inside of a scheduler. There are many reasons for this, such as the fact that blocking futures need to run on a blocking executor, and polling the blocking futures on the spawning thread would effectively deadlock the thread. Generally if you spawn something in a task you don't want to block the current future on it.

Also it's generally a bad idea to use try_tick, and run() should be used in most cases. See smol-rs/async-executor#88

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by cr1901
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants