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/simulator.h" | 5 #include "vm/simulator.h" |
6 #include "vm/thread_interrupter.h" | 6 #include "vm/thread_interrupter.h" |
7 | 7 |
8 namespace dart { | 8 namespace dart { |
9 | 9 |
10 // Notes: | 10 // Notes: |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data) { | 213 void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data) { |
214 // NoOp. | 214 // NoOp. |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 class ThreadInterrupterVisitIsolates : public IsolateVisitor { | 218 class ThreadInterrupterVisitIsolates : public IsolateVisitor { |
219 public: | 219 public: |
220 ThreadInterrupterVisitIsolates() { } | 220 ThreadInterrupterVisitIsolates() { } |
221 void VisitIsolate(Isolate* isolate) { | 221 void VisitIsolate(Isolate* isolate) { |
222 ASSERT(isolate != NULL); | 222 ASSERT(isolate != NULL); |
223 InterruptableThreadState* state = isolate->thread_state(); | 223 isolate->ProfileInterrupt(); |
224 if (state == NULL) { | |
225 return; | |
226 } | |
227 ASSERT(state->id != Thread::kInvalidThreadId); | |
228 ThreadInterrupter::InterruptThread(state); | |
229 } | 224 } |
230 }; | 225 }; |
231 | 226 |
232 | 227 |
233 void ThreadInterrupter::ThreadMain(uword parameters) { | 228 void ThreadInterrupter::ThreadMain(uword parameters) { |
234 ASSERT(initialized_); | 229 ASSERT(initialized_); |
235 InstallSignalHandler(); | 230 InstallSignalHandler(); |
236 if (FLAG_trace_thread_interrupter) { | 231 if (FLAG_trace_thread_interrupter) { |
237 OS::Print("ThreadInterrupter thread running.\n"); | 232 OS::Print("ThreadInterrupter thread running.\n"); |
238 } | 233 } |
(...skipping 17 matching lines...) Expand all Loading... |
256 } | 251 } |
257 { | 252 { |
258 // Signal to main thread we are exiting. | 253 // Signal to main thread we are exiting. |
259 MonitorLocker shutdown_ml(monitor_); | 254 MonitorLocker shutdown_ml(monitor_); |
260 thread_running_ = false; | 255 thread_running_ = false; |
261 shutdown_ml.Notify(); | 256 shutdown_ml.Notify(); |
262 } | 257 } |
263 } | 258 } |
264 | 259 |
265 } // namespace dart | 260 } // namespace dart |
OLD | NEW |