| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 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 Thread* thread = Thread::Current(); | 41 Thread* thread = Thread::Current(); |
| 42 Isolate* isolate = thread->isolate(); | 42 Isolate* isolate = thread->isolate(); |
| 43 // Thread interrupter interferes with this test, disable interrupts. | 43 // Thread interrupter interferes with this test, disable interrupts. |
| 44 thread->set_thread_state(NULL); | 44 thread->SetThreadInterrupter(NULL, NULL); |
| 45 Profiler::EndExecution(isolate); | 45 Profiler::EndExecution(isolate); |
| 46 Monitor* monitor = new Monitor(); | 46 Monitor* monitor = new Monitor(); |
| 47 monitor->Enter(); | 47 monitor->Enter(); |
| 48 monitor->Exit(); | 48 monitor->Exit(); |
| 49 | 49 |
| 50 const int kNumAttempts = 5; | 50 const int kNumAttempts = 5; |
| 51 int attempts = 0; | 51 int attempts = 0; |
| 52 while (attempts < kNumAttempts) { | 52 while (attempts < kNumAttempts) { |
| 53 MonitorLocker ml(monitor); | 53 MonitorLocker ml(monitor); |
| 54 int64_t start = OS::GetCurrentTimeMillis(); | 54 int64_t start = OS::GetCurrentTimeMillis(); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 // TODO(koda): Replace with execution of Dart and/or VM code when GC | 502 // TODO(koda): Replace with execution of Dart and/or VM code when GC |
| 503 // actually safepoints everything. | 503 // actually safepoints everything. |
| 504 MonitorLocker ml(&done_monitor); | 504 MonitorLocker ml(&done_monitor); |
| 505 while (!done) { | 505 while (!done) { |
| 506 ml.Wait(); | 506 ml.Wait(); |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 } | 509 } |
| 510 | 510 |
| 511 } // namespace dart | 511 } // namespace dart |
| OLD | NEW |