Re: Is only one JSContext allowed per thread in JS 76?

Jan de Mooij <[email protected]> Fri, 26 Jun 2020 14:20:21 +0200
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <CABTC+Je1tcF_bm4yapZNZOiSHWnL6n77S3wWp1-DpDA_hdaaoA@mail.gmail.com>
On Fri, Jun 26, 2020 at 9:40 AM Miles <[email protected]> wrote:

> Am I correct in thinking that only one JSContext is allowed per thread in
> JS 76 (even if it is the main thread)?
>

Correct.


> Only being able to have a single Context per thread seems to be a backward
> step to me and it's going to be a massive problem for our embedding.
> What was the rationale behind requiring it and do I have any alternatives
> other than making each Context a separate thread?
>

We used to depend on having multiple contexts per runtime in Gecko, but it
was really hard to reason about them because it wasn't very clear what a
JSContext represented exactly. So this was simplified to just having one
context per runtime / thread. Can you say more about why your embedding
need multiple contexts? What doesn't work if you create one context?

Thanks,
Jan