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

Side by Side Diff: test/cctest/test-thread-termination.cc

Issue 9969092: Fix race condition in test-thread-termination. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 { 248 {
249 v8::Locker locker; 249 v8::Locker locker;
250 for (int i = 0; i < kThreads; i++) { 250 for (int i = 0; i < kThreads; i++) {
251 v8::V8::TerminateExecution(threads[i]->GetV8ThreadId()); 251 v8::V8::TerminateExecution(threads[i]->GetV8ThreadId());
252 } 252 }
253 } 253 }
254 for (int i = 0; i < kThreads; i++) { 254 for (int i = 0; i < kThreads; i++) {
255 threads[i]->Join(); 255 threads[i]->Join();
256 delete threads[i]; 256 delete threads[i];
257 } 257 }
258 {
259 v8::Locker locker;
260 v8::Locker::StopPreemption();
261 }
258 262
259 delete semaphore; 263 delete semaphore;
260 semaphore = NULL; 264 semaphore = NULL;
261 } 265 }
262 266
263 267
264 int call_count = 0; 268 int call_count = 0;
265 269
266 270
267 v8::Handle<v8::Value> TerminateOrReturnObject(const v8::Arguments& args) { 271 v8::Handle<v8::Value> TerminateOrReturnObject(const v8::Arguments& args) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 v8::Handle<v8::String> source = 366 v8::Handle<v8::String> source =
363 v8::String::New("try { loop(); fail(); } catch(e) { fail(); }"); 367 v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
364 v8::Script::Compile(source)->Run(); 368 v8::Script::Compile(source)->Run();
365 CHECK(!v8::V8::IsExecutionTerminating()); 369 CHECK(!v8::V8::IsExecutionTerminating());
366 // Check we can run JS again after termination. 370 // Check we can run JS again after termination.
367 CHECK(v8::Script::Compile(v8::String::New("function f() { return true; }" 371 CHECK(v8::Script::Compile(v8::String::New("function f() { return true; }"
368 "f()"))->Run()->IsTrue()); 372 "f()"))->Run()->IsTrue());
369 context.Dispose(); 373 context.Dispose();
370 } 374 }
371 375
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698