3 ms·
Ok, did a bit of reading for myself. I had obviously only vaguely took in what was said when it was first released as a language feature. So async will run al
by louthy 11y ago
Ok, did a bit of reading for myself. I had obviously only vaguely took in what was said when it was first released as a language feature. So async will run all code on the current thread, until it gets to some IO. At that point it switches to running the code that you'd normally expect to run asynchronously. Once the IO returns it runs the remainder of the async 'closure' (for want of a better word) with the result. A kind of coroutines system, I guess similar to node.js.
- edgyswingset 11y agoYep! The async model in node.js is very similar. Here's a fantastic blog post about the details of it all: http://blog.stephencleary.com/2013/11/there-is-no-thread.html http://blog.stephencleary.com/2013/11/there-is-no-thread.htm...