Re: How to create a new runtime in spidermonkey 60
Ted Campbell <[email protected]> Thu, 15 Aug 2019 06:13:28 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <[email protected]> |
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.