| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 | 222 |
| 223 InterruptableThreadState* ThreadInterrupter::GetCurrentThreadState() { | 223 InterruptableThreadState* ThreadInterrupter::GetCurrentThreadState() { |
| 224 return _EnsureThreadStateCreated(); | 224 return _EnsureThreadStateCreated(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 | 227 |
| 228 InterruptableThreadState* ThreadInterrupter::CurrentThreadState() { | 228 InterruptableThreadState* ThreadInterrupter::CurrentThreadState() { |
| 229 return Thread::Current()->thread_state(); | 229 Thread* thread = Thread::Current(); |
| 230 return (thread == NULL) ? NULL : thread->thread_state(); |
| 230 } | 231 } |
| 231 | 232 |
| 232 | 233 |
| 233 void ThreadInterrupter::SetCurrentThreadState(InterruptableThreadState* state) { | 234 void ThreadInterrupter::SetCurrentThreadState(InterruptableThreadState* state) { |
| 234 Thread::Current()->set_thread_state(state); | 235 Thread::Current()->set_thread_state(state); |
| 235 } | 236 } |
| 236 | 237 |
| 237 | 238 |
| 238 void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data) { | 239 void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data) { |
| 239 // NoOp. | 240 // NoOp. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 } | 313 } |
| 313 { | 314 { |
| 314 // Signal to main thread we are exiting. | 315 // Signal to main thread we are exiting. |
| 315 MonitorLocker shutdown_ml(monitor_); | 316 MonitorLocker shutdown_ml(monitor_); |
| 316 thread_running_ = false; | 317 thread_running_ = false; |
| 317 shutdown_ml.Notify(); | 318 shutdown_ml.Notify(); |
| 318 } | 319 } |
| 319 } | 320 } |
| 320 | 321 |
| 321 } // namespace dart | 322 } // namespace dart |
| OLD | NEW |