C/C++ API Reference
Loading...
Searching...
No Matches
pw::async2::RunnableDispatcher Class Referenceabstract

Overview

Dispatcher that supports being run in a user-determined thread. Not all Dispatcher implementations can be used in this way.

Inheritance diagram for pw::async2::RunnableDispatcher:
pw::async2::Dispatcher pw::async2::BasicDispatcher pw::async2::DispatcherForTestFacade< Native > pw::async2::EpollDispatcher pw::async2::NotifiedDispatcher

Public Member Functions

bool RunUntilStalled ()
 
void RunToCompletion ()
 
void RunForever ()
 
- Public Member Functions inherited from pw::async2::Dispatcher
 Dispatcher (Dispatcher &)=delete
 
Dispatcheroperator= (Dispatcher &)=delete
 
 Dispatcher (Dispatcher &&)=delete
 
Dispatcheroperator= (Dispatcher &&)=delete
 
void Post (Task &task)
 
void LogRegisteredTasks ()
 

Private Member Functions

virtual void DoWaitForWake ()=0
 

Friends

template<typename >
class DispatcherForTestFacade
 

Additional Inherited Members

- Protected Types inherited from pw::async2::Dispatcher
enum  RunTaskResult { kActive = Task::kActive , kDeregistered = Task::kDeregistered , kCompleted = Task::kCompleted }
 
- Protected Member Functions inherited from pw::async2::Dispatcher
bool PopAndRunAllReadyTasks ()
 
TaskPopTaskToRun ()
 
TaskPopTaskToRun (bool &has_posted_tasks)
 
TaskPopSingleTaskForThisWake ()
 
RunTaskResult RunTask (Task &task)
 

Member Function Documentation

◆ DoWaitForWake()

virtual void pw::async2::RunnableDispatcher::DoWaitForWake ( )
privatepure virtual

Blocks until DoWake() is called. Must return immediately if DoWake() was already called since the last DoWaitForWake call.

If the implementation is unable to block the thread, it must crash.

Implemented in pw::async2::BasicDispatcher, pw::async2::DispatcherForTestFacade< Native >, pw::async2::EpollDispatcher, and pw::async2::NotifiedDispatcher.

◆ RunForever()

void pw::async2::RunnableDispatcher::RunForever ( )

Runs the dispatcher on this thread indefinitely, sleeping when there is no work to perform.

◆ RunToCompletion()

void pw::async2::RunnableDispatcher::RunToCompletion ( )

Runs tasks on the dispatcher until all tasks are completed, blocking the thread as needed.

Note
RunToCompletion returns when there are no tasks on the dispatcher, but new tasks could be posted to RunToCompletion from another thread before the function even returns.

◆ RunUntilStalled()

bool pw::async2::RunnableDispatcher::RunUntilStalled ( )
inline

Runs tasks until no further progress can be made.

Return values
trueThere are still sleeping tasks in the dispatcher.
falseAll tasks ran to completion.

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