Hacker News new | ask | show | jobs
by huxingyi 2462 days ago
Neat! I checked the async.h, looks like it doesn't support nested calls? I did a similar toy many years ago, which could be used with other async libraries such as libuv: https://github.com/huxingyi/c-block
1 comments

Nested async calls are supported, there's an example at the end of the article. Ordinary calls simply have to return before the next await statement, and obviously you don't want to make blocking calls.

Async/await semantically doesn't support resumption from deep in the stack, so it's a good choice for this sort of trick.