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" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
| 14 #ifndef PRODUCT |
| 15 |
14 // Notes: | 16 // Notes: |
15 // | 17 // |
16 // The ThreadInterrupter interrupts all threads actively running isolates once | 18 // The ThreadInterrupter interrupts all threads actively running isolates once |
17 // per interrupt period (default is 1 millisecond). While the thread is | 19 // per interrupt period (default is 1 millisecond). While the thread is |
18 // interrupted, the thread's interrupt callback is invoked. Callbacks cannot | 20 // interrupted, the thread's interrupt callback is invoked. Callbacks cannot |
19 // rely on being executed on the interrupted thread. | 21 // rely on being executed on the interrupted thread. |
20 // | 22 // |
21 // There are two mechanisms used to interrupt a thread. The first, used on OSs | 23 // There are two mechanisms used to interrupt a thread. The first, used on OSs |
22 // with pthreads (Android, Linux, and Mac), is thread specific signal delivery. | 24 // with pthreads (Android, Linux, and Mac), is thread specific signal delivery. |
23 // The second, used on Windows, is explicit suspend and resume thread system | 25 // The second, used on Windows, is explicit suspend and resume thread system |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 OS::Print("ThreadInterrupter thread exiting.\n"); | 219 OS::Print("ThreadInterrupter thread exiting.\n"); |
218 } | 220 } |
219 { | 221 { |
220 // Signal to main thread we are exiting. | 222 // Signal to main thread we are exiting. |
221 MonitorLocker shutdown_ml(monitor_); | 223 MonitorLocker shutdown_ml(monitor_); |
222 thread_running_ = false; | 224 thread_running_ = false; |
223 shutdown_ml.Notify(); | 225 shutdown_ml.Notify(); |
224 } | 226 } |
225 } | 227 } |
226 | 228 |
| 229 #endif // !PRODUCT |
| 230 |
227 } // namespace dart | 231 } // namespace dart |
OLD | NEW |