| 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 22 matching lines...) Expand all Loading... |
| 33 static void Unregister(); | 33 static void Unregister(); |
| 34 | 34 |
| 35 // Interrupt a thread. | 35 // Interrupt a thread. |
| 36 static void InterruptThread(Thread* thread); | 36 static void InterruptThread(Thread* thread); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 static const intptr_t kMaxThreads = 4096; | 39 static const intptr_t kMaxThreads = 4096; |
| 40 static bool initialized_; | 40 static bool initialized_; |
| 41 static bool shutdown_; | 41 static bool shutdown_; |
| 42 static bool thread_running_; | 42 static bool thread_running_; |
| 43 static ThreadId interrupter_thread_id_; | 43 static ThreadJoinId interrupter_thread_id_; |
| 44 static Monitor* monitor_; | 44 static Monitor* monitor_; |
| 45 static intptr_t interrupt_period_; | 45 static intptr_t interrupt_period_; |
| 46 static intptr_t current_wait_time_; | 46 static intptr_t current_wait_time_; |
| 47 | 47 |
| 48 static bool InDeepSleep() { | 48 static bool InDeepSleep() { |
| 49 return current_wait_time_ == Monitor::kNoTimeout; | 49 return current_wait_time_ == Monitor::kNoTimeout; |
| 50 } | 50 } |
| 51 | 51 |
| 52 static void UpdateStateObject(ThreadInterruptCallback callback, void* data); | 52 static void UpdateStateObject(ThreadInterruptCallback callback, void* data); |
| 53 | 53 |
| 54 static void ThreadMain(uword parameters); | 54 static void ThreadMain(uword parameters); |
| 55 | 55 |
| 56 static void InstallSignalHandler(); | 56 static void InstallSignalHandler(); |
| 57 | 57 |
| 58 static void RemoveSignalHandler(); | 58 static void RemoveSignalHandler(); |
| 59 | 59 |
| 60 friend class ThreadInterrupterVisitIsolates; | 60 friend class ThreadInterrupterVisitIsolates; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data); | 63 void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data); |
| 64 | 64 |
| 65 } // namespace dart | 65 } // namespace dart |
| 66 | 66 |
| 67 #endif // VM_THREAD_INTERRUPTER_H_ | 67 #endif // VM_THREAD_INTERRUPTER_H_ |
| OLD | NEW |