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 #ifndef VM_THREAD_INTERRUPTER_H_ | 5 #ifndef VM_THREAD_INTERRUPTER_H_ |
6 #define VM_THREAD_INTERRUPTER_H_ | 6 #define VM_THREAD_INTERRUPTER_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/signal_handler.h" | 9 #include "vm/signal_handler.h" |
10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 static void Startup(); | 28 static void Startup(); |
29 static void Shutdown(); | 29 static void Shutdown(); |
30 | 30 |
31 // Delay between interrupts. | 31 // Delay between interrupts. |
32 static void SetInterruptPeriod(intptr_t period); | 32 static void SetInterruptPeriod(intptr_t period); |
33 | 33 |
34 // Wake up the thread interrupter thread. | 34 // Wake up the thread interrupter thread. |
35 static void WakeUp(); | 35 static void WakeUp(); |
36 | 36 |
37 // Interrupt a thread. | 37 // Interrupt a thread. |
38 static void InterruptThread(Thread* thread); | 38 static void InterruptThread(OSThread* thread); |
39 | 39 |
40 private: | 40 private: |
41 static const intptr_t kMaxThreads = 4096; | 41 static const intptr_t kMaxThreads = 4096; |
42 static bool initialized_; | 42 static bool initialized_; |
43 static bool shutdown_; | 43 static bool shutdown_; |
44 static bool thread_running_; | 44 static bool thread_running_; |
45 static bool woken_up_; | 45 static bool woken_up_; |
46 static ThreadJoinId interrupter_thread_id_; | 46 static ThreadJoinId interrupter_thread_id_; |
47 static Monitor* monitor_; | 47 static Monitor* monitor_; |
48 static intptr_t interrupt_period_; | 48 static intptr_t interrupt_period_; |
49 static intptr_t current_wait_time_; | 49 static intptr_t current_wait_time_; |
50 | 50 |
51 static bool InDeepSleep() { | 51 static bool InDeepSleep() { |
52 return current_wait_time_ == Monitor::kNoTimeout; | 52 return current_wait_time_ == Monitor::kNoTimeout; |
53 } | 53 } |
54 | 54 |
55 static void ThreadMain(uword parameters); | 55 static void ThreadMain(uword parameters); |
56 | 56 |
57 static void InstallSignalHandler(); | 57 static void InstallSignalHandler(); |
58 | 58 |
59 static void RemoveSignalHandler(); | 59 static void RemoveSignalHandler(); |
60 | 60 |
61 friend class ThreadInterrupterVisitIsolates; | 61 friend class ThreadInterrupterVisitIsolates; |
62 }; | 62 }; |
63 | 63 |
64 } // namespace dart | 64 } // namespace dart |
65 | 65 |
66 #endif // VM_THREAD_INTERRUPTER_H_ | 66 #endif // VM_THREAD_INTERRUPTER_H_ |
OLD | NEW |