But if I use multiples isolates, I won't be able to share objects across Isolates' contexts ? No ?
In my case, (AMD Require implementation) the result of my second thread execution is supposed to be used in my main thread. On Thursday, June 12, 2014 10:35:57 PM UTC+2, Jochen Eisinger wrote: > > although it's using the same mechanism as the old preemption code used to > use, right? > > But I agree that this is not necessarily going to work forever. > > Typically, I'd expect an embedder to use multiple isolates if they wish to > run script on different threads in parallel. > > best > -jochen > > > > On Thu, Jun 12, 2014 at 4:24 AM, Vyacheslav Egorov <[email protected] > <javascript:>> wrote: > >> I would like to note that RequestInterrupt was not intended as a >> replacement for preemption. We didn't want callback executing any >> JavaScript in the interrupted isolate, so we put the following requirement >> on the interrupt callback: >> >> >> *Registered |callback| must not reenter interrupted Isolate.* >> >> This requirement is not checked right now, but neither anything is >> guaranteed to work if you try and start executing JavaScript in the >> interrupted isolate from the callback or from another thread (by unlocking >> isolate in the callback and allowing other thread to lock it). >> >> >> Vyacheslav Egorov >> >> >> On Thu, Jun 12, 2014 at 1:10 PM, juu <[email protected] <javascript:> >> > wrote: >> >>> Ok, I didn't notice this API available since v8 3.25. >>> >>> I will have to wait for my team to migrate to a new version of v8 then >>> ... >>> >>> Thanks >>> Julien. >>> On Thursday, June 12, 2014 1:44:27 AM UTC+2, Jochen Eisinger wrote: >>>> >>>> >>>> >>>> >>>> On Tue, Jun 10, 2014 at 8:38 AM, juu <[email protected]> wrote: >>>> >>>>> Hello everyone, >>>>> >>>>> I'm trying to implement RequireJS on my JS Engine based on v8 (v8 >>>>> 3.21). I have a problem with asynchronous loading and evaluation of >>>>> scripts. >>>>> >>>>> The main thread initialize v8 : create its isolate, context, script >>>>> etc .. >>>>> When the main script is ready, the current isolate is locked and the >>>>> script is run. >>>>> >>>>> Once a " *require(anotherScript)* " is encoutered (in my main >>>>> script), another thread is created and is in charge of loading >>>>> *anotherScript >>>>> *and execute it as soon as possible. >>>>> >>>>> My problem is that the main thread lock the current isolate until the >>>>> whole main script is executed. Which let no chance to *anotherScript *to >>>>> be called asynchronously ; actually it's always executed synchronously >>>>> since *anotherScript *manage to Lock the current isolate only once >>>>> the main thread is finished and unlock the current isolate. >>>>> >>>>> I use v8::Locker and v8::Locker to deal with my "multithreaded" use of >>>>> v8. In my version of v8 : 3.21, v8::Locker provide a preemption feature >>>>> which enable me to give some chance to other threads to lock v8 >>>>> periodically : >>>>> >>>>> /**Start preemption.When preemption is started, a timer is fired every >>>>> n milliseconds that will switch between multiple threads that are in >>>>> contention for the V8 lock. */ >>>>> static void StartPreemption(int every_n_ms); >>>>> >>>>> /** Stop preemption.*/ >>>>> static void StopPreemption(); >>>>> >>>>> But ...this feature is no longer available in the next versions of v8 >>>>> (since 3.23) . >>>>> This post confirm it : https://groups.google.com/ >>>>> forum/#!searchin/v8-users/StartPreemption/v8-users/ >>>>> E5jtPC-scp8/H-2yz4Wj_SkJ >>>>> >>>>> So here are my questions : >>>>> >>>>> Is there any other way to perform the Preemption v8 used to provide ? >>>>> Am I supposed to do it myself ? I dont think I can, I guess can't >>>>> interrupt/pause myself the execution properly... >>>>> >>>> >>>> I guess you can do this by using the RequestInterrupt API? >>>> >>>> best >>>> -jochen >>>> >>>> >>>> >>>>> Am I doing something wrong in my global use of v8 and multiple >>>>> threads ? >>>>> >>>>> Thanks a lot ! >>>>> Julien. >>>>> >>>>> -- >>>>> -- >>>>> v8-users mailing list >>>>> [email protected] >>>>> >>>>> http://groups.google.com/group/v8-users >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "v8-users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>> -- >>> v8-users mailing list >>> [email protected] <javascript:> >>> http://groups.google.com/group/v8-users >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "v8-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected] <javascript:>. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> -- >> v8-users mailing list >> [email protected] <javascript:> >> http://groups.google.com/group/v8-users >> --- >> You received this message because you are subscribed to the Google Groups >> "v8-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
