> I'm assuming you mean "system thread". But in effect, isn't it very much like a green thread ?
Async/await (or generators/yield if you prefer) are very different from green threads. Green threads are still preemptive and managed by the VM. Async/await, on the other hand, is basically a nice syntax addition that allows for a more expressive form of cooperative multi-tasking. As Andrew already said, there's nothing that you can do with async/await that you couldn't *exactly* replicate using regular ol' callbacks. It's too early to say this authoritatively, but it seems that async/await will likely sit on top of Promises; that alone should indicate that we won't be seeing any departures from current async semantics. Even the current generator/yield implementations are essentially accomplished via CPS transforms. In short, preemption would be pretty devastating to JavaScript. On Monday, August 19, 2013 8:36:08 AM UTC-4, Floby wrote: > > >other functions can resume and run within the same thread > > I'm assuming you mean "system thread". But in effect, isn't it very much > like a green thread ? (userspace managed ?) > > On Sunday, 18 August 2013 08:18:55 UTC+2, Andrew Gaspar wrote: >> >> On Sat, Aug 17, 2013 at 6:14 AM, Floby <[email protected]> wrote: >> >>> I've read that article too. >>> >>> It seems to me that async/wait is a more elegant approach than twisting >>> the yield semantics. >>> However I don't quite see how this differs from blocking I/O calls and >>> threads. >>> >>> These are cooperative threads, wihch were also an acceptable programming >>> model in the 60's >>> >>> >> Async/await doesn't block a thread. That's the point. It's *exactly*like >> node - other functions can resume and run within the same thread while >> another asynchronous action is being awaited. You could essentially rewrite >> all await code to use callbacks and have the exact same functionality - it >> just reduces code complexity. >> > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
