We are using V8 as our Javascript engine. As part of our project design ,
we need to execute the JS code from multiple threads. As documentation
says, V8 isolate is not thread safe, we are wrapping the V8 entry points
with Locker object so that only one thread can access the V8 api at any
point of time but this making the other threads to wait for longer time if
the thread-1 is doing some long pending operation. Now we want to make the
thread-1 release the lock using Unlocker api when ever it is doing some
non-v8 operation so that other threads can enter. But this is not working
for us as V8 is crashing when we trying to create object using
Object::New() api from thread-2.
Here is the code level visualization,
jsFun code snippet
================
function myfun(obj){
nativeAnimation(); // this is native callback
}
native function
=============
void nativeAnimation(Args){
....
Unlocker unlock;
gameengine->animate(); //while it unlocks and another thread enter v8 but
crashes whenever creating Object::New()
.....
}
Thread-1
=======
Locker
V8 api {
Handle<Object> obj = Object::New(); //It works
jsFun->Call(obj); // this js function calls "nativeAnimation" api
which is a callback to to game engine and this spends some time in engine.
}
Thread-2
========
Locker
V8 api {
Handle<Object> obj = Object::New(); //It crashes here
}
Can Some one help me to understand whether it is possible to Unlock while
in the middle of some JS function execution and entered by another thread.?
--
--
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.