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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
7 #include "platform/utils.h" | 7 #include "platform/utils.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 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2963 ASSERT(interrupt_count < kInterruptCount); | 2963 ASSERT(interrupt_count < kInterruptCount); |
2964 return true; | 2964 return true; |
2965 } | 2965 } |
2966 | 2966 |
2967 | 2967 |
2968 TEST_CASE(IsolateInterrupt) { | 2968 TEST_CASE(IsolateInterrupt) { |
2969 Dart_IsolateInterruptCallback saved = Isolate::InterruptCallback(); | 2969 Dart_IsolateInterruptCallback saved = Isolate::InterruptCallback(); |
2970 Isolate::SetInterruptCallback(IsolateInterruptTestCallback); | 2970 Isolate::SetInterruptCallback(IsolateInterruptTestCallback); |
2971 | 2971 |
2972 sync = new Monitor(); | 2972 sync = new Monitor(); |
2973 Thread* thread = new Thread(BusyLoop_start, 0); | 2973 int result = Thread::Start(BusyLoop_start, 0); |
2974 EXPECT(thread != NULL); | 2974 EXPECT_EQ(0, result); |
2975 | 2975 |
2976 { | 2976 { |
2977 MonitorLocker ml(sync); | 2977 MonitorLocker ml(sync); |
2978 // Wait for the other isolate to enter main. | 2978 // Wait for the other isolate to enter main. |
2979 while (!main_entered) { | 2979 while (!main_entered) { |
2980 ml.Wait(); | 2980 ml.Wait(); |
2981 } | 2981 } |
2982 } | 2982 } |
2983 | 2983 |
2984 // Send a number of interrupts to the other isolate. All but the | 2984 // Send a number of interrupts to the other isolate. All but the |
(...skipping 24 matching lines...) Expand all Loading... |
3009 // We should have received the expected number of interrupts. | 3009 // We should have received the expected number of interrupts. |
3010 EXPECT_EQ(kInterruptCount, interrupt_count); | 3010 EXPECT_EQ(kInterruptCount, interrupt_count); |
3011 | 3011 |
3012 // Give the spawned thread enough time to properly exit. | 3012 // Give the spawned thread enough time to properly exit. |
3013 Isolate::SetInterruptCallback(saved); | 3013 Isolate::SetInterruptCallback(saved); |
3014 } | 3014 } |
3015 | 3015 |
3016 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 3016 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
3017 | 3017 |
3018 } // namespace dart | 3018 } // namespace dart |
OLD | NEW |