To be clear spawnTimeoutThread won't yield you any parallelism, yes? All it gets you is some kind of preemption and multiple stacks?
On Sat, Apr 2, 2011 at 5:27 PM, Stephan Beal <[email protected]> wrote: > On Sat, Apr 2, 2011 at 8:07 AM, Marcel Laverdet <[email protected]>wrote: > >> ...If most of your work will take place outside the VM (through native C++ >> extensions) then perhaps running JS with no parallelism will be ok, because >> you can make your API calls asynchronous and parallel.. but the actual JS >> will be 1 thread. >> > > To expand a bit on that: it is impossible to write thread-safe code in pure > JS because JS lacks the data types/operations needed, like mutexes. As i > understand it, the next version of JS will have a "yield" keywork (or > function?) which can be used to help implement non-preemptive threading, but > JS will never be a full-thread-feature language. > > That said, i wrote a variant of setTimeout() which runs its code in another > thread, and that might be of interest to you: > > http://code.google.com/p/v8-juice/wiki/ThreadingInJS > > -- > ----- stephan beal > http://wanderinghorse.net/home/stephan/ > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
