Skip to content

Comment on A Design Space Exploration of Async/Awaitparent

Comments

Async/await syntax doesn't guarantee what kind mechanism is servicing the async work. Consider a situation where you have limited threads (perhaps even only one servicing both sync and async calls).

Blocking that thread to wait for an async call would prevent the async call from completing and would be a deadlock.

As noted, you can run sync code from an async context. Even if you have a thread pool, blocking in sync has a chance to block and consume an async worker thread. That can also cause deadlocks.

They don't make it easy to wait synchronously because it's a bad idea. Making the syntax more amicable to blocking is a worse idea.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.