Flutter Engine
flutter_runner::Thread Class Reference

#include <thread.h>

Public Member Functions

 Thread ()
 
 ~Thread ()
 
void Quit ()
 
bool Join ()
 
bool IsValid () const
 
async_dispatcher_t * dispatcher () const
 

Detailed Description

Definition at line 18 of file thread.h.

Constructor & Destructor Documentation

◆ Thread()

flutter_runner::Thread::Thread ( )

Definition at line 65 of file thread.cc.

References flutter_runner::MakeObservableLoop().

65  {
66  loop_.reset(MakeObservableLoop(false));
67  valid_ = CreateThread(
68  &thread_, [](Thread* thread) { thread->Main(); }, this, 1 << 20);
69 }
async::Loop * MakeObservableLoop(bool attachToThread)
Definition: loop.cc:42

◆ ~Thread()

flutter_runner::Thread::~Thread ( )

Definition at line 71 of file thread.cc.

References Join().

71  {
72  Join();
73 }

Member Function Documentation

◆ dispatcher()

async_dispatcher_t * flutter_runner::Thread::dispatcher ( ) const

Definition at line 79 of file thread.cc.

79  {
80  return loop_->dispatcher();
81 }

◆ IsValid()

bool flutter_runner::Thread::IsValid ( ) const

Definition at line 75 of file thread.cc.

75  {
76  return valid_;
77 }

◆ Join()

bool flutter_runner::Thread::Join ( )

Definition at line 92 of file thread.cc.

Referenced by ~Thread().

92  {
93  if (!valid_) {
94  return false;
95  }
96 
97  bool result = pthread_join(thread_, nullptr) == 0;
98  valid_ = false;
99  return result;
100 }

◆ Quit()

void flutter_runner::Thread::Quit ( )

Definition at line 88 of file thread.cc.

88  {
89  loop_->Quit();
90 }

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