Multiple JSRuntime per single thread

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

Multiple JSRuntime per single thread

vfoltz
Hi!

I create many JS runtimes on single (GUI) thread. Everything worked fine before obsoleting JS_SetContextThread/JS_ClearContextThread and introducing JS_SetRuntimeThread/JS_ClearRuntimeThread.

Now it seems that multiple runtimes cannot live on one thread together (see JSRuntime::assertValidThread). What is the point for this technical decision? I have a very basic use case like executing JS in multiple windows. Am I supposed to   do JS_SetRuntimeThread/JS_ClearRuntimeThread before/after every JS API call even if I do not use mutilpe threads? What if I want to run some JS action (in separate JS runtime) being in callback from another JS runtime?
_______________________________________________
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: Multiple JSRuntime per single thread

vfoltz
> Now it seems that multiple runtimes cannot live on one thread together

I took a closer look on the problem and now it seems like a showstopper for me. Let's say I run a modal dialog from JS callback. Then I press a button in the dialog and want to run some JS action on another JSRuntime. Here goes showstopper. I cannot do JS_ClearRuntimeThread on original JSRuntime because it is asserting that there are no active requests (request is active because I still in the callback). And I cannot just use another JSRuntime because it is asserting that there is no JSRuntime associated with current thread. I'm stuck.
I cannot use a single JSRuntime for the whole application (I must control separately memory consumption by different windows). And I cannot use separate threads for different windows (without major GUI reorganizing). Please help!
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine