On Sat, Apr 2, 2011 at 8:07 AM, Marcel Laverdet <mar...@laverdet.com> 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
v8-users@googlegroups.com
http://groups.google.com/group/v8-users

Reply via email to