Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: test/cctest/test-thread-termination.cc

Issue 6788023: Per-isolate v8::Locker and v8::Unlocker (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixes for simulator (arm/mips) Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-lockers.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-thread-termination.cc
diff --git a/test/cctest/test-thread-termination.cc b/test/cctest/test-thread-termination.cc
index 5635b1761c639829b4bce3ff555e6689fb899a87..1e8a627c42c0a19ff4722561da783374bde9d5b9 100644
--- a/test/cctest/test-thread-termination.cc
+++ b/test/cctest/test-thread-termination.cc
@@ -221,29 +221,37 @@ class LoopingThread : public v8::internal::Thread {
};
-// Test that multiple threads using V8 can be terminated from another
-// thread when using Lockers and preemption.
-TEST(TerminateMultipleV8Threads) {
+// Test that multiple threads using default isolate can be terminated
+// from another thread when using Lockers and preemption.
+TEST(TerminateMultipleV8ThreadsDefaultIsolate) {
{
v8::Locker locker;
v8::V8::Initialize();
v8::Locker::StartPreemption(1);
semaphore = v8::internal::OS::CreateSemaphore(0);
}
- LoopingThread thread1(i::Isolate::Current());
- thread1.Start();
- LoopingThread thread2(i::Isolate::Current());
- thread2.Start();
- // Wait until both threads have signaled the semaphore.
- semaphore->Wait();
- semaphore->Wait();
+ const int kThreads = 2;
+ i::List<LoopingThread*> threads(kThreads);
+ for (int i = 0; i < kThreads; i++) {
+ threads.Add(new LoopingThread(i::Isolate::Current()));
+ }
+ for (int i = 0; i < kThreads; i++) {
+ threads[i]->Start();
+ }
+ // Wait until all threads have signaled the semaphore.
+ for (int i = 0; i < kThreads; i++) {
+ semaphore->Wait();
+ }
{
v8::Locker locker;
- v8::V8::TerminateExecution(thread1.GetV8ThreadId());
- v8::V8::TerminateExecution(thread2.GetV8ThreadId());
+ for (int i = 0; i < kThreads; i++) {
+ v8::V8::TerminateExecution(threads[i]->GetV8ThreadId());
+ }
+ }
+ for (int i = 0; i < kThreads; i++) {
+ threads[i]->Join();
+ delete threads[i];
}
- thread1.Join();
- thread2.Join();
delete semaphore;
semaphore = NULL;
« no previous file with comments | « test/cctest/test-lockers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698