From e1db94c0cb28c36aa568f08d9087e0b3e4fee832 Mon Sep 17 00:00:00 2001 From: "mikhail.naganov@gmail.com" Date: Fri, 10 Jun 2011 09:36:35 +0000 Subject: [PATCH] trying to fix test git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8256 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- include/v8.h | 2 +- src/api.cc | 7 ++++--- test/cctest/test-thread-termination.cc | 13 +++++++++---- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/v8.h b/include/v8.h index 443e064..e3e51ec 100644 --- a/include/v8.h +++ b/include/v8.h @@ -3099,7 +3099,7 @@ class V8EXPORT V8 { * 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 diff --git a/src/api.cc b/src/api.cc index 91e4618..ec1cb6f 100644 --- a/src/api.cc +++ b/src/api.cc @@ -4902,9 +4902,10 @@ void V8::TerminateExecution(Isolate* isolate) { } -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(isolate) : i::Isolate::Current(); + return IsExecutionTerminatingCheck(i_isolate); } diff --git a/test/cctest/test-thread-termination.cc b/test/cctest/test-thread-termination.cc index 9e6cb4d..1aa57e3 100644 --- a/test/cctest/test-thread-termination.cc +++ b/test/cctest/test-thread-termination.cc @@ -160,12 +160,17 @@ TEST(TerminateOnlyV8ThreadFromThreadItselfNoLoop) { class TerminatorThread : public v8::internal::Thread { public: - TerminatorThread() : Thread("TerminatorThread") { } + explicit TerminatorThread(i::Isolate* isolate) + : Thread("TerminatorThread"), + isolate_(reinterpret_cast(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_; }; @@ -173,7 +178,7 @@ class TerminatorThread : public v8::internal::Thread { // 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; -- 2.7.4