Re:Ask HN: Why can't await be used from non-async functions?
by endorphine on Monday February 28, 2022 @04:00PM
(#30505066)
Can you elaborate on why there's a risk of a deadlock?
[ Parent
| on HN ]
Re:Ask HN: Why can't await be used from non-async functions?
by Merad on Monday February 28, 2022 @10:59PM
(#30509317)
The very short version is that by synchronously blocking on the async method your thread may end up holding a resource (thread context info or the calling thread itself) that the async method needs in order to run its continuations. Here are a couple of more detailed explanations:
https://blog.stephencleary.com/2012/07/dont-block-on-async-c...
https://devblogs.microsoft.com/pfxteam/await-and-ui-and-dead...
Re:Ask HN: Why can't await be used from non-async functions?
by endorphine on Tuesday March 01, 2022 @02:05AM
(#30510629)
Now that's pretty much the answer I was looking for, I believe. This makes things much clearer!