Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multiple JSRuntime per single thread

53 views
Skip to first unread message

vfo...@meta-comm.com

unread,
Mar 20, 2013, 4:24:57 PM3/20/13
to
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?

vfo...@meta-comm.com

unread,
Mar 21, 2013, 1:45:42 AM3/21/13
to
> 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!
0 new messages