OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "vm/thread_interrupter.h" | 5 #include "vm/thread_interrupter.h" |
6 | 6 |
7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
8 #include "vm/lockers.h" | 8 #include "vm/lockers.h" |
9 #include "vm/os.h" | 9 #include "vm/os.h" |
10 #include "vm/simulator.h" | 10 #include "vm/simulator.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 ASSERT(initialized_); | 150 ASSERT(initialized_); |
151 InstallSignalHandler(); | 151 InstallSignalHandler(); |
152 if (FLAG_trace_thread_interrupter) { | 152 if (FLAG_trace_thread_interrupter) { |
153 OS::Print("ThreadInterrupter thread running.\n"); | 153 OS::Print("ThreadInterrupter thread running.\n"); |
154 } | 154 } |
155 { | 155 { |
156 // Signal to main thread we are ready. | 156 // Signal to main thread we are ready. |
157 MonitorLocker startup_ml(monitor_); | 157 MonitorLocker startup_ml(monitor_); |
158 OSThread* os_thread = OSThread::Current(); | 158 OSThread* os_thread = OSThread::Current(); |
159 ASSERT(os_thread != NULL); | 159 ASSERT(os_thread != NULL); |
160 interrupter_thread_id_ = os_thread->join_id(); | 160 interrupter_thread_id_ = OSThread::GetCurrentThreadJoinId(os_thread); |
161 thread_running_ = true; | 161 thread_running_ = true; |
162 startup_ml.Notify(); | 162 startup_ml.Notify(); |
163 } | 163 } |
164 { | 164 { |
165 intptr_t interrupted_thread_count = 0; | 165 intptr_t interrupted_thread_count = 0; |
166 MonitorLocker wait_ml(monitor_); | 166 MonitorLocker wait_ml(monitor_); |
167 current_wait_time_ = interrupt_period_; | 167 current_wait_time_ = interrupt_period_; |
168 while (!shutdown_) { | 168 while (!shutdown_) { |
169 intptr_t r = wait_ml.WaitMicros(current_wait_time_); | 169 intptr_t r = wait_ml.WaitMicros(current_wait_time_); |
170 | 170 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // Signal to main thread we are exiting. | 222 // Signal to main thread we are exiting. |
223 MonitorLocker shutdown_ml(monitor_); | 223 MonitorLocker shutdown_ml(monitor_); |
224 thread_running_ = false; | 224 thread_running_ = false; |
225 shutdown_ml.Notify(); | 225 shutdown_ml.Notify(); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 #endif // !PRODUCT | 229 #endif // !PRODUCT |
230 | 230 |
231 } // namespace dart | 231 } // namespace dart |
OLD | NEW |