| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // any pending rendezvous request (if none, returns immediately). | 49 // any pending rendezvous request (if none, returns immediately). |
| 50 void CheckSafepoint() { | 50 void CheckSafepoint() { |
| 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 void PrepareForGC(); |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 void AddThreadToActiveList(Thread* thread); | 62 void AddThreadToActiveList(Thread* thread); |
| 62 void RemoveThreadFromActiveList(Thread* thread); | 63 void RemoveThreadFromActiveList(Thread* thread); |
| 63 Thread* GetThreadFromFreelist(Isolate* isolate); | 64 Thread* GetThreadFromFreelist(Isolate* isolate); |
| 64 void ReturnThreadToFreelist(Thread* thread); | 65 void ReturnThreadToFreelist(Thread* thread); |
| 65 | 66 |
| 66 // Note: Lock should be taken before this function is called. | 67 // Note: Lock should be taken before this function is called. |
| 67 void CheckSafepointLocked(); | 68 void CheckSafepointLocked(); |
| 68 | 69 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 93 intptr_t remaining_; // Number of threads yet to reach their safepoint. | 94 intptr_t remaining_; // Number of threads yet to reach their safepoint. |
| 94 int64_t round_; // Counter, to prevent missing updates to remaining_ | 95 int64_t round_; // Counter, to prevent missing updates to remaining_ |
| 95 // (see comments in CheckSafepointLocked). | 96 // (see comments in CheckSafepointLocked). |
| 96 | 97 |
| 97 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); | 98 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 } // namespace dart | 101 } // namespace dart |
| 101 | 102 |
| 102 #endif // VM_THREAD_REGISTRY_H_ | 103 #endif // VM_THREAD_REGISTRY_H_ |
| OLD | NEW |