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...
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.

Reply via email to