The first option would be ideal, as I could precompile all the scripts once against a single context/runtime, and then invoke them on different threads with different contexts. Otherwise, I'd need to create multiple copies of the runtime and precompile separately on each thread.
> Hi All,
> Been working on embedding Spidermonkey 31 into my application, and
> am hoping to get some recommendations for a multi-threaded
> This document
> https://developer.mozilla.org/en-US/docs/Mozilla/Projects/ > SpiderMonkey/JSAPI_reference/JS_NewRuntime, seems to suggest that I
> can share a single JSRuntime instance and then have one context per
I'm afraid that documentation is long out of date. (I've updated it.)
You can use a JSRuntime from one thread only, though the JS engine may
use some helper threads transparently.