Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
dart::ThreadRegistry Class Reference

#include <thread_registry.h>

Public Member Functions

 ThreadRegistry ()
 
 ~ThreadRegistry ()
 
void VisitObjectPointers (IsolateGroup *isolate_group_of_interest, ObjectPointerVisitor *visitor, ValidationPolicy validate_frames)
 
void ForEachThread (std::function< void(Thread *thread)> callback)
 
void ReleaseStoreBuffers ()
 
void AcquireMarkingStacks ()
 
void ReleaseMarkingStacks ()
 
void FlushMarkingStacks ()
 
intptr_t active_isolates_count ()
 
Monitorthreads_lock () const
 
void PrintJSON (JSONStream *stream) const
 

Friends

class Thread
 
class SafepointHandler
 

Detailed Description

Definition at line 23 of file thread_registry.h.

Constructor & Destructor Documentation

◆ ThreadRegistry()

dart::ThreadRegistry::ThreadRegistry ( )
inline

Definition at line 25 of file thread_registry.h.

26 : threads_lock_(),
27 active_list_(nullptr),
28 free_list_(nullptr),
29 active_isolates_count_(0) {}

◆ ~ThreadRegistry()

dart::ThreadRegistry::~ThreadRegistry ( )

Definition at line 12 of file thread_registry.cc.

12 {
13 // Go over the free thread list and delete the thread objects.
14 {
15 MonitorLocker ml(threads_lock());
16 // At this point the active list should be empty.
17 ASSERT(active_list_ == nullptr);
18
19 // Now delete all the threads in the free list.
20 while (free_list_ != nullptr) {
21 Thread* thread = free_list_;
22 free_list_ = thread->next_;
23 delete thread;
24 }
25 }
26}
Monitor * threads_lock() const
#define ASSERT(E)

Member Function Documentation

◆ AcquireMarkingStacks()

void dart::ThreadRegistry::AcquireMarkingStacks ( )

Definition at line 83 of file thread_registry.cc.

83 {
84 MonitorLocker ml(threads_lock());
85 Thread* thread = active_list_;
86 while (thread != nullptr) {
87 if (!thread->BypassSafepoints()) {
88 thread->AcquireMarkingStacks();
89 }
90 thread = thread->next_;
91 }
92}

◆ active_isolates_count()

intptr_t dart::ThreadRegistry::active_isolates_count ( )
inline

Definition at line 43 of file thread_registry.h.

43{ return active_isolates_count_.load(); }
T load(std::memory_order order=std::memory_order_relaxed) const
Definition: atomic.h:21

◆ FlushMarkingStacks()

void dart::ThreadRegistry::FlushMarkingStacks ( )

Definition at line 106 of file thread_registry.cc.

106 {
107 MonitorLocker ml(threads_lock());
108 Thread* thread = active_list_;
109 while (thread != nullptr) {
110 if (!thread->BypassSafepoints() && thread->is_marking()) {
111 thread->FlushMarkingStacks();
112 ASSERT(thread->is_marking());
113 }
114 thread = thread->next_;
115 }
116}

◆ ForEachThread()

void dart::ThreadRegistry::ForEachThread ( std::function< void(Thread *thread)>  callback)

Definition at line 62 of file thread_registry.cc.

63 {
64 MonitorLocker ml(threads_lock());
65 Thread* thread = active_list_;
66 while (thread != nullptr) {
67 callback(thread);
68 thread = thread->next_;
69 }
70}
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ PrintJSON()

void dart::ThreadRegistry::PrintJSON ( JSONStream stream) const

◆ ReleaseMarkingStacks()

void dart::ThreadRegistry::ReleaseMarkingStacks ( )

Definition at line 94 of file thread_registry.cc.

94 {
95 MonitorLocker ml(threads_lock());
96 Thread* thread = active_list_;
97 while (thread != nullptr) {
98 if (!thread->BypassSafepoints()) {
99 thread->ReleaseMarkingStacks();
100 ASSERT(!thread->is_marking());
101 }
102 thread = thread->next_;
103 }
104}

◆ ReleaseStoreBuffers()

void dart::ThreadRegistry::ReleaseStoreBuffers ( )

Definition at line 72 of file thread_registry.cc.

72 {
73 MonitorLocker ml(threads_lock());
74 Thread* thread = active_list_;
75 while (thread != nullptr) {
76 if (!thread->BypassSafepoints()) {
77 thread->ReleaseStoreBuffer();
78 }
79 thread = thread->next_;
80 }
81}
void ReleaseStoreBuffer()
Definition: thread.cc:677

◆ threads_lock()

Monitor * dart::ThreadRegistry::threads_lock ( ) const
inline

Definition at line 45 of file thread_registry.h.

45{ return &threads_lock_; }

◆ VisitObjectPointers()

void dart::ThreadRegistry::VisitObjectPointers ( IsolateGroup isolate_group_of_interest,
ObjectPointerVisitor visitor,
ValidationPolicy  validate_frames 
)

Definition at line 44 of file thread_registry.cc.

47 {
48 MonitorLocker ml(threads_lock());
49 Thread* thread = active_list_;
50 while (thread != nullptr) {
51 if (thread->isolate_group() == isolate_group_of_interest) {
52 // The mutator thread is visited by the isolate itself (see
53 // [IsolateGroup::VisitStackPointers]).
54 if (!thread->IsDartMutatorThread()) {
55 thread->VisitObjectPointers(visitor, validate_frames);
56 }
57 }
58 thread = thread->next_;
59 }
60}
void VisitObjectPointers(ObjectPointerVisitor *visitor, ValidationPolicy validate_frames)
Definition: thread.cc:968

Friends And Related Function Documentation

◆ SafepointHandler

friend class SafepointHandler
friend

Definition at line 69 of file thread_registry.h.

◆ Thread

friend class Thread
friend

Definition at line 68 of file thread_registry.h.


The documentation for this class was generated from the following files: