Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::SpawnTask Class Reference
Inheritance diagram for dart::SpawnTask:
dart::ThreadPool::Task dart::IntrusiveDListEntry< Task >

Public Member Functions

 SpawnTask (ThreadPool *pool, Monitor *sync, int todo, int total, int *done)
 
virtual void Run ()
 
- Public Member Functions inherited from dart::ThreadPool::Task
virtual ~Task ()
 
- Public Member Functions inherited from dart::IntrusiveDListEntry< Task >
 IntrusiveDListEntry ()
 
 ~IntrusiveDListEntry ()
 

Additional Inherited Members

- Protected Member Functions inherited from dart::ThreadPool::Task
 Task ()
 

Detailed Description

Definition at line 209 of file thread_pool_test.cc.

Constructor & Destructor Documentation

◆ SpawnTask()

dart::SpawnTask::SpawnTask ( ThreadPool pool,
Monitor sync,
int  todo,
int  total,
int done 
)
inline

Definition at line 211 of file thread_pool_test.cc.

212 : pool_(pool), sync_(sync), todo_(todo), total_(total), done_(done) {}
AutoreleasePool pool
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
Definition DM.cpp:263

Member Function Documentation

◆ Run()

virtual void dart::SpawnTask::Run ( )
inlinevirtual

Implements dart::ThreadPool::Task.

Definition at line 214 of file thread_pool_test.cc.

214 {
215 todo_--; // Subtract one for current task.
216 int child_todo = todo_ / 2;
217
218 // Spawn 0-2 children.
219 if (todo_ > 0) {
220 pool_->Run<SpawnTask>(pool_, sync_, todo_ - child_todo, total_, done_);
221 }
222 if (todo_ > 1) {
223 pool_->Run<SpawnTask>(pool_, sync_, child_todo, total_, done_);
224 }
225
226 {
227 MonitorLocker ml(sync_);
228 (*done_)++;
229 if (*done_ >= total_) {
230 ml.Notify();
231 }
232 }
233 }
SpawnTask(ThreadPool *pool, Monitor *sync, int todo, int total, int *done)
bool Run(Args &&... args)
Definition thread_pool.h:45

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