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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // Join the thread. | 105 // Join the thread. |
106 ASSERT(interrupter_thread_id_ != OSThread::kInvalidThreadJoinId); | 106 ASSERT(interrupter_thread_id_ != OSThread::kInvalidThreadJoinId); |
107 OSThread::Join(interrupter_thread_id_); | 107 OSThread::Join(interrupter_thread_id_); |
108 interrupter_thread_id_ = OSThread::kInvalidThreadJoinId; | 108 interrupter_thread_id_ = OSThread::kInvalidThreadJoinId; |
109 | 109 |
110 if (FLAG_trace_thread_interrupter) { | 110 if (FLAG_trace_thread_interrupter) { |
111 OS::Print("ThreadInterrupter shut down.\n"); | 111 OS::Print("ThreadInterrupter shut down.\n"); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
| 115 |
115 // Delay between interrupts. | 116 // Delay between interrupts. |
116 void ThreadInterrupter::SetInterruptPeriod(intptr_t period) { | 117 void ThreadInterrupter::SetInterruptPeriod(intptr_t period) { |
117 if (shutdown_) { | 118 if (shutdown_) { |
118 return; | 119 return; |
119 } | 120 } |
120 ASSERT(initialized_); | 121 ASSERT(initialized_); |
121 ASSERT(period > 0); | 122 ASSERT(period > 0); |
122 interrupt_period_ = period; | 123 interrupt_period_ = period; |
123 } | 124 } |
124 | 125 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 219 } |
219 { | 220 { |
220 // Signal to main thread we are exiting. | 221 // Signal to main thread we are exiting. |
221 MonitorLocker shutdown_ml(monitor_); | 222 MonitorLocker shutdown_ml(monitor_); |
222 thread_running_ = false; | 223 thread_running_ = false; |
223 shutdown_ml.Notify(); | 224 shutdown_ml.Notify(); |
224 } | 225 } |
225 } | 226 } |
226 | 227 |
227 } // namespace dart | 228 } // namespace dart |
OLD | NEW |