OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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_REGISTRY_H_ | 5 #ifndef VM_THREAD_REGISTRY_H_ |
6 #define VM_THREAD_REGISTRY_H_ | 6 #define VM_THREAD_REGISTRY_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 MonitorLocker ml(monitor_); | 51 MonitorLocker ml(monitor_); |
52 CheckSafepointLocked(); | 52 CheckSafepointLocked(); |
53 } | 53 } |
54 | 54 |
55 bool AtSafepoint() const { return in_rendezvous_; } | 55 bool AtSafepoint() const { return in_rendezvous_; } |
56 Thread* Schedule(Isolate* isolate, bool is_mutator, bool bypass_safepoint); | 56 Thread* Schedule(Isolate* isolate, bool is_mutator, bool bypass_safepoint); |
57 void Unschedule(Thread* thread, bool is_mutator, bool bypass_safepoint); | 57 void Unschedule(Thread* thread, bool is_mutator, bool bypass_safepoint); |
58 void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames); | 58 void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames); |
59 | 59 |
60 private: | 60 private: |
| 61 void AddThreadToActiveList(Thread* thread); |
| 62 void RemoveThreadFromActiveList(Thread* thread); |
61 Thread* GetThreadFromFreelist(Isolate* isolate); | 63 Thread* GetThreadFromFreelist(Isolate* isolate); |
62 void ReturnThreadToFreelist(Thread* thread); | 64 void ReturnThreadToFreelist(Thread* thread); |
63 | 65 |
64 // Note: Lock should be taken before this function is called. | 66 // Note: Lock should be taken before this function is called. |
65 void CheckSafepointLocked(); | 67 void CheckSafepointLocked(); |
66 | 68 |
67 // Returns the number threads that are scheduled on this isolate. | 69 // Returns the number threads that are scheduled on this isolate. |
68 // Note: Lock should be taken before this function is called. | 70 // Note: Lock should be taken before this function is called. |
69 intptr_t CountScheduledLocked(); | 71 intptr_t CountScheduledLocked(); |
70 | 72 |
(...skipping 20 matching lines...) Expand all Loading... |
91 intptr_t remaining_; // Number of threads yet to reach their safepoint. | 93 intptr_t remaining_; // Number of threads yet to reach their safepoint. |
92 int64_t round_; // Counter, to prevent missing updates to remaining_ | 94 int64_t round_; // Counter, to prevent missing updates to remaining_ |
93 // (see comments in CheckSafepointLocked). | 95 // (see comments in CheckSafepointLocked). |
94 | 96 |
95 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); | 97 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); |
96 }; | 98 }; |
97 | 99 |
98 } // namespace dart | 100 } // namespace dart |
99 | 101 |
100 #endif // VM_THREAD_REGISTRY_H_ | 102 #endif // VM_THREAD_REGISTRY_H_ |
OLD | NEW |