Hacker News new | ask | show | jobs
by colinsane 1021 days ago
> You can break the chain by commanding the entire runtime to block on the completion of a future, but you probably shouldn’t do this pervasively since it isn’t composable. If a function blocks on a future, and that future calls a function that blocks on a future, congrats! The runtime panics!

article says you can panic if you use the pattern you show. specifically, if you call `my_normal_code()` from an async context.

is the author just talking about a quirk in tokio? or is this sort of wrapping intrinsically dangerous somehow?

1 comments

It's not intrinsic to async functions; you can block on a future inside another future via e.g. pollster or even manual polling.