JSRuntime thread management

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

JSRuntime thread management

James Dunning
Hi All,

Been working on embedding Spidermonkey 31 into my application, and am hoping to get some recommendations for a multi-threaded application.

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 thread.

However, a comment on this post https://groups.google.com/forum/#!topic/mozilla.dev.tech.js-engine/LJm98wAy4hc seems to suggest that a Runtime must be associated with a single thread..

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.

Any help/guidance would be much appreciated.
-James
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: JSRuntime thread management

Ms2ger
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi James,

On 09/07/2015 06:21 PM, James Dunning wrote:

> Hi All,
>
> Been working on embedding Spidermonkey 31 into my application, and
> am hoping to get some recommendations for a multi-threaded
> application.
>
> 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
> thread.
>

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.

HTH
Ms2ger
-----BEGIN PGP SIGNATURE-----

iQEcBAEBAgAGBQJV7oMcAAoJEOXgvIL+s8n2CfwH/1s9TRiYRoa7u0eQasWvPA4M
9ZLFIo3qwaXMnRTso0r37cXlEW52OMKRnSBm0bOZlRdTY/Lx0K/HtTRUYn6djXyO
VAFtknLp4WG97QN4Dv3y7SJ5VQGzoSgDBtw5otB9aIeTg5TfN9l+/hZcIddXDxJm
DKb5Wbk7uyI3mEoFGGlQuH3mEJ4x8my5JmnJJTyzfJop6tg1aULRVU1zDI6QAkJG
t4VlDQbFRxo0aV50g0yqnedBntOhGB5osWi8ltY+SUFqsqVsI+xwVhL5qUVkU3lJ
jqZFlpzKNZy7dyt0xP5OjrJ4WXvWSmOHGVeGJhXQTfVli4gf0YoaqA9xWT4VsCs=
=BLdu
-----END PGP SIGNATURE-----
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine