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

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

Issue 9141005: Change the thread interface in runtime/platform and use it starting all threads (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from asiva@ Created 8 years, 10 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 | Annotate | Revision Log
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 "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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698