You mentioned that "if...is trivial enough, it will not trigger a
stack guard check. "
I found the following script can't be terminated by
v8::V8::TerminateExecution(), is it caused by the reason you mentioned
above?
for (;;)
{
print("Still running");
}
If we want to terminate the above script, what should we do?
There is another overloaded API v8::V8::TerminateExecution(int
threadID), will that works?
Reproduction steps:
-----------------------------
There is a test-thread-termination.cc under project ccTest,
Change function Doloop to following, then the test case
"test-thread-termination/TerminateOnlyV8ThreadFromThreadItself" will
fail
v8::Handle<v8::Value> DoLoop(const v8::Arguments& args) {
v8::TryCatch try_catch;
//v8::Script::Compile(v8::String::New("function f() {"
// " var term = true;"
// " try {"
// " while(true) {"
// " if (term) terminate
();"
// " term = false;"
// " }"
// " fail();"
// " } catch(e) {"
// " fail();"
// " }"
// "}"
// "f()"))->Run();
v8::Script::Compile(v8::String::New("var term = true; while(true)
{if
(term) terminate(); term = false;}"))->Run();
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsNull());
CHECK(try_catch.Message().IsEmpty());
CHECK(!try_catch.CanContinue());
return v8::Undefined();