| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/assert.h" | 7 #include "vm/assert.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
| 10 #include "vm/thread.h" | 10 #include "vm/thread.h" |
| (...skipping 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3084 // Wait for the other isolate to enter main. | 3084 // Wait for the other isolate to enter main. |
| 3085 while (!main_entered) { | 3085 while (!main_entered) { |
| 3086 ml.Wait(); | 3086 ml.Wait(); |
| 3087 } | 3087 } |
| 3088 } | 3088 } |
| 3089 | 3089 |
| 3090 // Send a number of interrupts to the other isolate. All but the | 3090 // Send a number of interrupts to the other isolate. All but the |
| 3091 // last allow execution to continue. The last causes an exception in | 3091 // last allow execution to continue. The last causes an exception in |
| 3092 // the isolate. | 3092 // the isolate. |
| 3093 for (int i = 0; i < kInterruptCount; i++) { | 3093 for (int i = 0; i < kInterruptCount; i++) { |
| 3094 // Space out the interrupts a bit. |
| 3094 OS::Sleep(i + 1); | 3095 OS::Sleep(i + 1); |
| 3095 Dart_InterruptIsolate(shared_isolate); | 3096 Dart_InterruptIsolate(shared_isolate); |
| 3096 { | 3097 { |
| 3097 MonitorLocker ml(sync); | 3098 MonitorLocker ml(sync); |
| 3098 // Wait for interrupt_count to be increased. | 3099 // Wait for interrupt_count to be increased. |
| 3099 while (interrupt_count == i) { | 3100 while (interrupt_count == i) { |
| 3100 ml.Wait(); | 3101 ml.Wait(); |
| 3101 } | 3102 } |
| 3102 OS::Print(" ========== Interrupt processed #%d\n", interrupt_count); | 3103 OS::Print(" ========== Interrupt processed #%d\n", interrupt_count); |
| 3103 } | 3104 } |
| 3104 // Space out the interrupts a bit. | |
| 3105 } | 3105 } |
| 3106 | 3106 |
| 3107 { | 3107 { |
| 3108 MonitorLocker ml(sync); | 3108 MonitorLocker ml(sync); |
| 3109 // Wait for our isolate to finish. | 3109 // Wait for our isolate to finish. |
| 3110 while (shared_isolate != NULL) { | 3110 while (shared_isolate != NULL) { |
| 3111 ml.Wait(); | 3111 ml.Wait(); |
| 3112 } | 3112 } |
| 3113 } | 3113 } |
| 3114 | 3114 |
| 3115 // We should have received the expected number of interrupts. | 3115 // We should have received the expected number of interrupts. |
| 3116 EXPECT_EQ(kInterruptCount, interrupt_count); | 3116 EXPECT_EQ(kInterruptCount, interrupt_count); |
| 3117 | 3117 |
| 3118 // Give the spawned thread enough time to properly exit. | 3118 // Give the spawned thread enough time to properly exit. |
| 3119 Isolate::SetInterruptCallback(saved); | 3119 Isolate::SetInterruptCallback(saved); |
| 3120 } | 3120 } |
| 3121 | 3121 |
| 3122 #endif // TARGET_ARCH_IA32. | 3122 #endif // TARGET_ARCH_IA32. |
| 3123 | 3123 |
| 3124 } // namespace dart | 3124 } // namespace dart |
| OLD | NEW |