Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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->MarkingStackAcquire();
89 thread->DeferredMarkingStackAcquire();
90 }
91 thread = thread->next_;
92 }
93}

◆ 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 108 of file thread_registry.cc.

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

◆ 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 95 of file thread_registry.cc.

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

◆ 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:672

◆ 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:901

Friends And Related Symbol 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: