Re: How to create a new runtime in spidermonkey 60

msami <[email protected]> Tue, 20 Aug 2019 05:08:28 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On Thursday, August 15, 2019 at 3:13:29 PM UTC+2, Ted Campbell wrote:
> On Thursday, August 15, 2019 at 5:11:42 AM UTC-4, msami wrote:
> > Thanks for your reply, I created 2 instances Segmentation fault happenn on constructor 
> 
> Only one JSContext can be created per thread. If you want multiple runtimes, you will need to create the new threads first and then create a JSContext on each thread.
> 
> JS_Init() only needs to be called once per-process, but JS::InitSelfHostedCode(cx) will need to be called once for each JSContext you create.
> 
> Note that if you use multiple runtimes, they will not be able to share JS pointers with each other. You will need to implement some sort of thread-safe message passing / serialization if you need the runtimes to communicate directly. This is how 'Worker's work on the web.

thanks for the reply if there is any reference I should read please provide it