Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like async support, but always, in async examples, doesn't the await keyword just block anyways?

I like to see the usage of async inside of a main loop, where other things can be processed while waiting for the async response to come in.

Further, not all applications have the idea of an event loop, so async may not be needed, but it's useful to have the option.

I use async operations to multiplex operations in a queue. The linux scheduler can handle the execution time slices for me, I'm not going to build a scheduler, but the queue controller's role is to accept jobs and handle timeouts and results of each async operation.



> doesn't the await keyword just block anyways?

The await keyword only blocks the execution of the coroutine in which it is used. It releases the event loop so that other coroutines can continue processing while the result of an awaitable is being fetched.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: