Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
fml::ThreadHandle Class Reference

Public Member Functions

 ThreadHandle (ThreadFunction &&function)
 
 ~ThreadHandle ()
 
void Join ()
 

Detailed Description

Definition at line 29 of file thread.cc.

Constructor & Destructor Documentation

◆ ThreadHandle()

fml::ThreadHandle::ThreadHandle ( ThreadFunction &&  function)
explicit

Definition at line 66 of file thread.cc.

66 {
67 pthread_attr_t attr;
68 pthread_attr_init(&attr);
69 int result = pthread_attr_setstacksize(&attr, Thread::GetDefaultStackSize());
70 FML_CHECK(result == 0);
71 result = pthread_create(
72 &thread_, &attr,
73 [](void* arg) -> void* {
74 std::unique_ptr<ThreadFunction> function(
75 reinterpret_cast<ThreadFunction*>(arg));
76 (*function)();
77 return nullptr;
78 },
79 new ThreadFunction(std::move(function)));
80 FML_CHECK(result == 0);
81 result = pthread_attr_destroy(&attr);
82 FML_CHECK(result == 0);
83}
static size_t GetDefaultStackSize()
Definition: thread.cc:177
GAsyncResult * result
#define FML_CHECK(condition)
Definition: logging.h:85
Dart_NativeFunction function
Definition: fuchsia.cc:51
std::function< void()> ThreadFunction
Definition: thread.cc:27

◆ ~ThreadHandle()

fml::ThreadHandle::~ThreadHandle ( )

Definition at line 89 of file thread.cc.

89{}

Member Function Documentation

◆ Join()

void fml::ThreadHandle::Join ( )

Definition at line 85 of file thread.cc.

85 {
86 pthread_join(thread_, nullptr);
87}

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