| OLD | NEW |
| 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifndef SRC_VM_SCHEDULER_H_ | 5 #ifndef SRC_VM_SCHEDULER_H_ |
| 6 #define SRC_VM_SCHEDULER_H_ | 6 #define SRC_VM_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include "src/shared/atomic.h" | 8 #include "src/shared/atomic.h" |
| 9 | 9 |
| 10 #include "src/vm/signal.h" | 10 #include "src/vm/signal.h" |
| 11 #include "src/vm/thread_pool.h" | 11 #include "src/vm/thread_pool.h" |
| 12 #include "src/vm/thread.h" | 12 #include "src/vm/thread.h" |
| 13 | 13 |
| 14 namespace fletch { | 14 namespace dartino { |
| 15 | 15 |
| 16 class GCThread; | 16 class GCThread; |
| 17 class Heap; | 17 class Heap; |
| 18 class Object; | 18 class Object; |
| 19 class Port; | 19 class Port; |
| 20 class ProcessQueue; | 20 class ProcessQueue; |
| 21 class Process; | 21 class Process; |
| 22 class Program; | 22 class Program; |
| 23 | 23 |
| 24 const int kCompileTimeErrorExitCode = 254; | 24 const int kCompileTimeErrorExitCode = 254; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // is attached or the session might call them if it is about to end. | 130 // is attached or the session might call them if it is about to end. |
| 131 // | 131 // |
| 132 // TODO(kustermann): Once we've made more progress on the design of a | 132 // TODO(kustermann): Once we've made more progress on the design of a |
| 133 // multiprocess system, we should consider making an abstraction for these. | 133 // multiprocess system, we should consider making an abstraction for these. |
| 134 void ExitAtTermination(Process* process, Signal::Kind kind); | 134 void ExitAtTermination(Process* process, Signal::Kind kind); |
| 135 void ExitAtUncaughtException(Process* process, bool print_stack); | 135 void ExitAtUncaughtException(Process* process, bool print_stack); |
| 136 void ExitAtCompileTimeError(Process* process); | 136 void ExitAtCompileTimeError(Process* process); |
| 137 void ExitAtBreakpoint(Process* process); | 137 void ExitAtBreakpoint(Process* process); |
| 138 | 138 |
| 139 private: | 139 private: |
| 140 friend class Fletch; | 140 friend class Dartino; |
| 141 | 141 |
| 142 // Global scheduler instance. | 142 // Global scheduler instance. |
| 143 static Scheduler* scheduler_; | 143 static Scheduler* scheduler_; |
| 144 | 144 |
| 145 ThreadPool thread_pool_; | 145 ThreadPool thread_pool_; |
| 146 | 146 |
| 147 Atomic<bool> interpreter_is_paused_; | 147 Atomic<bool> interpreter_is_paused_; |
| 148 Atomic<ThreadState*> interpreting_thread_; | 148 Atomic<ThreadState*> interpreting_thread_; |
| 149 ProcessQueue* ready_queue_; | 149 ProcessQueue* ready_queue_; |
| 150 | 150 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 Monitor* monitor_; | 210 Monitor* monitor_; |
| 211 Program** programs_; | 211 Program** programs_; |
| 212 int* exitcodes_; | 212 int* exitcodes_; |
| 213 int count_; | 213 int count_; |
| 214 int remaining_; | 214 int remaining_; |
| 215 | 215 |
| 216 static void CaptureExitCode(Program* program, int exitcode, void* data); | 216 static void CaptureExitCode(Program* program, int exitcode, void* data); |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 | 219 |
| 220 } // namespace fletch | 220 } // namespace dartino |
| 221 | 221 |
| 222 #endif // SRC_VM_SCHEDULER_H_ | 222 #endif // SRC_VM_SCHEDULER_H_ |
| OLD | NEW |