* still JavaScript frames on the stack and the termination
* exception is still active.
*/
- static bool IsExecutionTerminating();
+ static bool IsExecutionTerminating(Isolate* isolate = NULL);
/**
* Releases any resources used by v8 and stops any utility threads
}
-bool V8::IsExecutionTerminating() {
- i::Isolate* isolate = i::Isolate::Current();
- return IsExecutionTerminatingCheck(isolate);
+bool V8::IsExecutionTerminating(Isolate* isolate) {
+ i::Isolate* i_isolate = isolate != NULL ?
+ reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current();
+ return IsExecutionTerminatingCheck(i_isolate);
}
class TerminatorThread : public v8::internal::Thread {
public:
- TerminatorThread() : Thread("TerminatorThread") { }
+ explicit TerminatorThread(i::Isolate* isolate)
+ : Thread("TerminatorThread"),
+ isolate_(reinterpret_cast<v8::Isolate*>(isolate)) { }
void Run() {
semaphore->Wait();
- CHECK(!v8::V8::IsExecutionTerminating());
- v8::V8::TerminateExecution();
+ CHECK(!v8::V8::IsExecutionTerminating(isolate_));
+ v8::V8::TerminateExecution(isolate_);
}
+
+ private:
+ v8::Isolate* isolate_;
};
// from the side by another thread.
TEST(TerminateOnlyV8ThreadFromOtherThread) {
semaphore = v8::internal::OS::CreateSemaphore(0);
- TerminatorThread thread;
+ TerminatorThread thread(i::Isolate::Current());
thread.Start();
v8::HandleScope scope;