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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 8995008: Fix issue 906 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 2ef04569b9fc6889f030f795ff2ee916a604b5ef..77d09a05550343a9cf80dfbf254a43e77c4e6e89 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -2912,7 +2912,11 @@ void BusyLoop_start(uword unused) {
// on the third interrupt.
static int interrupt_count = 0;
static bool IsolateInterruptTestCallback() {
- interrupt_count++;
+ {
+ MonitorLocker ml(sync);
+ interrupt_count++;
+ ml.Notify();
+ }
OS::Print(" =========== Interrupt callback called #%d\n", interrupt_count);
if (interrupt_count >= 3) {
Dart_EnterScope();
@@ -2948,11 +2952,17 @@ TEST_CASE(IsolateInterrupt) {
// Send three interrupts to the other isolate. The first two allow
// execution to continue. The third causes an exception in the
// isolate.
- Dart_InterruptIsolate(shared_isolate);
- OS::Sleep(5);
- Dart_InterruptIsolate(shared_isolate);
- OS::Sleep(5);
- Dart_InterruptIsolate(shared_isolate);
+ for (int i = 0; i < 3; i++) {
+ Dart_InterruptIsolate(shared_isolate);
+ OS::Sleep(5);
+ {
+ MonitorLocker ml(sync);
+ // Wait for interrupt_count to be increased.
+ while (interrupt_count == i) {
+ ml.Wait();
+ }
+ }
+ }
{
MonitorLocker ml(sync);
« 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