4 ms·
Async/await requires a run loop. Async functions are special functions that can suspend execution and jump back to the run loop, and at some later point the run
by newaccount74 5y ago
Async/await requires a run loop. Async functions are special functions that can suspend execution and jump back to the run loop, and at some later point the run loop continues them.
Normal functions can't do that. If they wait for something they block, they can't give control back to the run loop.
- endorphine 5y agoSo async functions are special functions that have the capability to be _paused_ until another asynchronous operation finishes (i.e. the thing we're `await`ing upon). And in a single-threaded environment, we _want_ this capability so that the loop is able to continue working despite the fact that the thing we're `await`ing for hasn't complete yet.