Re: JS_SetContextPrivate and friends are being removed

Josh Matthews <[email protected]>
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On 2016-06-25 3:30 PM, Braden McDaniel wrote:
> On Fri, 2016-06-24 at 11:13 -0500, Jason Orendorff wrote:
>> In the next release of SpiderMonkey, each thread that wants to use JS
>> must
>> have a single JSRuntime and a single JSContext. The two concepts are
>> being
>> unified. Work is ongoing; this week, <
>> https://bugzilla.mozilla.org/show_bug.cgi?id=1281529>;.
>>
>> As a result, we're removing these API functions:
>>   JS_GetContextPrivate
>>   JS_SetContextPrivate
>>   JS_GetSecondContextPrivate
>>   JS_SetSecondContextPrivate
>>
>> Rationale: Once you switch to a single JSRuntime and a single
>> JSContext
>> per-thread, these functions are useless. You can easily switch to
>> thread-local or global variables, which are much nicer: they have
>> names and
>> types, they can be any size, and you can have as many as you like.
>>
>> See <https://bugzilla.mozilla.org/show_bug.cgi?id=1281582>.
>
> Does this mean that if one wants separate scopes (that is, separate
> global objects), one *must* use separate threads?
>

It's perfectly fine to create multiple globals for the same runtime on 
the same thread.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.