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 | |
116 // Delay between interrupts. | 115 // Delay between interrupts. |
117 void ThreadInterrupter::SetInterruptPeriod(intptr_t period) { | 116 void ThreadInterrupter::SetInterruptPeriod(intptr_t period) { |
118 if (shutdown_) { | 117 if (shutdown_) { |
119 return; | 118 return; |
120 } | 119 } |
121 ASSERT(initialized_); | 120 ASSERT(initialized_); |
122 ASSERT(period > 0); | 121 ASSERT(period > 0); |
123 interrupt_period_ = period; | 122 interrupt_period_ = period; |
124 } | 123 } |
125 | 124 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 218 } |
220 { | 219 { |
221 // Signal to main thread we are exiting. | 220 // Signal to main thread we are exiting. |
222 MonitorLocker shutdown_ml(monitor_); | 221 MonitorLocker shutdown_ml(monitor_); |
223 thread_running_ = false; | 222 thread_running_ = false; |
224 shutdown_ml.Notify(); | 223 shutdown_ml.Notify(); |
225 } | 224 } |
226 } | 225 } |
227 | 226 |
228 } // namespace dart | 227 } // namespace dart |
OLD | NEW |