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

Public Member Functions

 SleepTask (Monitor *sync, int *started_count, int *slept_count, int millis)
 
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 101 of file thread_pool_test.cc.

Constructor & Destructor Documentation

◆ SleepTask()

dart::SleepTask::SleepTask ( Monitor sync,
int started_count,
int slept_count,
int  millis 
)
inline

Definition at line 103 of file thread_pool_test.cc.

104 : sync_(sync),
105 started_count_(started_count),
106 slept_count_(slept_count),
107 millis_(millis) {}

Member Function Documentation

◆ Run()

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

Implements dart::ThreadPool::Task.

Definition at line 109 of file thread_pool_test.cc.

109 {
110 {
111 MonitorLocker ml(sync_);
112 *started_count_ = *started_count_ + 1;
113 ml.Notify();
114 }
115 // Sleep so we can be sure the ThreadPool destructor blocks until we're
116 // done.
117 OS::Sleep(millis_);
118 {
119 MonitorLocker ml(sync_);
120 *slept_count_ = *slept_count_ + 1;
121 // No notification here. The main thread is blocked in ThreadPool
122 // shutdown waiting for this thread to finish.
123 }
124 }
static void Sleep(int64_t millis)

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