| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 static const intptr_t kMaxThreads = 4096; | 72 static const intptr_t kMaxThreads = 4096; |
| 73 static bool initialized_; | 73 static bool initialized_; |
| 74 static bool shutdown_; | 74 static bool shutdown_; |
| 75 static bool thread_running_; | 75 static bool thread_running_; |
| 76 static ThreadId interrupter_thread_id_; | 76 static ThreadId interrupter_thread_id_; |
| 77 static Monitor* monitor_; | 77 static Monitor* monitor_; |
| 78 static intptr_t interrupt_period_; | 78 static intptr_t interrupt_period_; |
| 79 static intptr_t current_wait_time_; | 79 static intptr_t current_wait_time_; |
| 80 static ThreadLocalKey thread_state_key_; | |
| 81 | 80 |
| 82 static bool InDeepSleep() { | 81 static bool InDeepSleep() { |
| 83 return current_wait_time_ == Monitor::kNoTimeout; | 82 return current_wait_time_ == Monitor::kNoTimeout; |
| 84 } | 83 } |
| 85 | 84 |
| 86 static InterruptableThreadState* _EnsureThreadStateCreated(); | 85 static InterruptableThreadState* _EnsureThreadStateCreated(); |
| 87 static void UpdateStateObject(ThreadInterruptCallback callback, void* data); | 86 static void UpdateStateObject(ThreadInterruptCallback callback, void* data); |
| 88 | 87 |
| 89 static void SetCurrentThreadState(InterruptableThreadState* state); | 88 static void SetCurrentThreadState(InterruptableThreadState* state); |
| 90 | 89 |
| 91 static void ThreadMain(uword parameters); | 90 static void ThreadMain(uword parameters); |
| 92 | 91 |
| 93 static void InstallSignalHandler(); | 92 static void InstallSignalHandler(); |
| 94 | 93 |
| 95 static void RemoveSignalHandler(); | 94 static void RemoveSignalHandler(); |
| 96 | 95 |
| 97 friend class ThreadInterrupterVisitIsolates; | 96 friend class ThreadInterrupterVisitIsolates; |
| 98 }; | 97 }; |
| 99 | 98 |
| 100 void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data); | 99 void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data); |
| 101 | 100 |
| 102 } // namespace dart | 101 } // namespace dart |
| 103 | 102 |
| 104 #endif // VM_THREAD_INTERRUPTER_H_ | 103 #endif // VM_THREAD_INTERRUPTER_H_ |
| OLD | NEW |