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

Side by Side Diff: runtime/vm/thread_test.cc

Issue 1261923008: Begin migration of InterruptableThreadState into Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Parentheses. Created 5 years, 4 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
« no previous file with comments | « runtime/vm/thread_interrupter.cc ('k') | 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/isolate.h" 6 #include "vm/isolate.h"
7 #include "vm/lockers.h" 7 #include "vm/lockers.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 #include "vm/profiler.h" 9 #include "vm/profiler.h"
10 #include "vm/thread_pool.h" 10 #include "vm/thread_pool.h"
(...skipping 20 matching lines...) Expand all
31 // purpose. 31 // purpose.
32 Dart_ShutdownIsolate(); 32 Dart_ShutdownIsolate();
33 delete mutex; 33 delete mutex;
34 } 34 }
35 35
36 36
37 UNIT_TEST_CASE(Monitor) { 37 UNIT_TEST_CASE(Monitor) {
38 // This unit test case needs a running isolate. 38 // This unit test case needs a running isolate.
39 Dart_CreateIsolate( 39 Dart_CreateIsolate(
40 NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL, NULL); 40 NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL, NULL);
41 Isolate* isolate = Isolate::Current(); 41 Thread* thread = Thread::Current();
42 Isolate* isolate = thread->isolate();
42 // Thread interrupter interferes with this test, disable interrupts. 43 // Thread interrupter interferes with this test, disable interrupts.
43 isolate->set_thread_state(NULL); 44 thread->set_thread_state(NULL);
44 Profiler::EndExecution(isolate); 45 Profiler::EndExecution(isolate);
45 Monitor* monitor = new Monitor(); 46 Monitor* monitor = new Monitor();
46 monitor->Enter(); 47 monitor->Enter();
47 monitor->Exit(); 48 monitor->Exit();
48 49
49 const int kNumAttempts = 5; 50 const int kNumAttempts = 5;
50 int attempts = 0; 51 int attempts = 0;
51 while (attempts < kNumAttempts) { 52 while (attempts < kNumAttempts) {
52 MonitorLocker ml(monitor); 53 MonitorLocker ml(monitor);
53 int64_t start = OS::GetCurrentTimeMillis(); 54 int64_t start = OS::GetCurrentTimeMillis();
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 while (true) { 432 while (true) {
432 isolate->thread_registry()->CheckSafepoint(); 433 isolate->thread_registry()->CheckSafepoint();
433 MutexLocker ml(&mutex); 434 MutexLocker ml(&mutex);
434 if (exited == SafepointTestTask::kTaskCount) { 435 if (exited == SafepointTestTask::kTaskCount) {
435 break; 436 break;
436 } 437 }
437 } 438 }
438 } 439 }
439 440
440 } // namespace dart 441 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/thread_interrupter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698