Hello. I want to set timeout for v8::Script::Run. I saw other posts about
this.I understood that I need to use StartPreemtion + Loker +
TerminateException. Consequently, v8::Script::Run should be in a separate
thread.
Calculation and control of the execution time should be in the main
thread.How can I create another thread in the v8? Unfortunately,I have a
little experience with v8. Please help me to understand how to do it.
Here is an example of the code as I do it, but the function of the
thread doesn't start.
v8::Local<v8::Value> V8ExecuteString( v8::Handle<v8::String> source,
v8::Handle<v8::String> filename )
{
// Compiling script
DWORD start_tick;
v8::Locker::StartPreemption( 1 );
{
v8::Unlocker unlocker;
boost::thread th ( [&] () {
v8::Locker locker;
v8::HandleScope handle_scope;
// v8::Script::Run()
});
}
v8::Locker locker;
v8::HandleScope handle_scope;
while ( true )
{
if( ( (::GetTickCount() - start_tick) / 1000 ) > 10 )
// v8::v8::TerminateException( )
}
v8::Locker::StopPreemption();
}
--
--
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/groups/opt_out.