On Thu, Apr 21, 2011 at 12:58 PM, Matthias Ernst <[email protected]>wrote:

> Let's turn the question around. How in the world does SpiderMonkey support
> multi-threading? How is it specified? Did they invent a memory-model for JS?
>

They have some magical macro called JS_THREADSAFE which, when set, enables
threading support.

The SpiderMonkey readme says:

----------
<a NAME="Build"></a>Build conventions (standalone JS engine and shell)
(OUT OF DATE!)</h2>
These build directions refer only to building the standalone JavaScript
engine and shell.&nbsp; To build within the browser, refer to the <a
href="http://www.mozilla.org/build/";>build
directions</a> on the mozilla.org website.
<p>By default, all platforms build a version of the JS engine that is
<i>not</i>
threadsafe.&nbsp; If you require thread-safety, you must also populate
the <tt>mozilla/dist</tt> directory with <a href="
http://www.mozilla.org/projects/nspr/reference/html/";
>NSPR</a>
headers and libraries.&nbsp; (NSPR implements a portable threading library,
among other things.&nbsp; The source is downloadable via <a href="
http://www.mozilla.org/cvs.html";>CVS</a>
from <tt><a href="http://lxr.mozilla.org/mozilla/source/nsprpub
">mozilla/nsprpub</a></tt>.)&nbsp;
Next, you must define <tt>JS_THREADSAFE</tt> when building the JS engine,
either on the command-line (gmake/nmake) or in a universal header file.
----------


Specific functions mention specific serialization requirements when
JS_THREADSAFE is set, but beyond that it's anyone's guess.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to