OLD | NEW |
1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_PREEMPTER_H_ | 5 #ifndef SRC_VM_PREEMPTER_H_ |
6 #define SRC_VM_PREEMPTER_H_ | 6 #define SRC_VM_PREEMPTER_H_ |
7 | 7 |
8 #include "src/shared/atomic.h" | 8 #include "src/shared/atomic.h" |
9 | 9 |
10 #include "src/vm/thread.h" | 10 #include "src/vm/thread.h" |
11 #include "src/vm/scheduler.h" | 11 #include "src/vm/scheduler.h" |
12 | 12 |
13 namespace fletch { | 13 namespace dartino { |
14 | 14 |
15 class Preempter { | 15 class Preempter { |
16 public: | 16 public: |
17 enum State { | 17 enum State { |
18 kAllocated, | 18 kAllocated, |
19 kInitialized, | 19 kInitialized, |
20 kFinishing, | 20 kFinishing, |
21 kFinished, | 21 kFinished, |
22 }; | 22 }; |
23 | 23 |
(...skipping 14 matching lines...) Expand all Loading... |
38 static ThreadIdentifier preempter_thread_; | 38 static ThreadIdentifier preempter_thread_; |
39 | 39 |
40 Monitor* preempt_monitor_; | 40 Monitor* preempt_monitor_; |
41 Atomic<State> state_; | 41 Atomic<State> state_; |
42 Scheduler* scheduler_; | 42 Scheduler* scheduler_; |
43 | 43 |
44 uint64 GetNextPreemptTime(); | 44 uint64 GetNextPreemptTime(); |
45 }; | 45 }; |
46 | 46 |
47 | 47 |
48 } // namespace fletch | 48 } // namespace dartino |
49 | 49 |
50 #endif // SRC_VM_PREEMPTER_H_ | 50 #endif // SRC_VM_PREEMPTER_H_ |
OLD | NEW |