C/C++ API Reference
Loading...
Searching...
No Matches
Dispatcher

Overview

Dispatcher interface and implementations.

Classes

class  pw::async2::BasicDispatcher
 
class  pw::async2::Dispatcher
 
class  pw::async2::RunnableDispatcher
 

Functions

void pw::async2::BasicDispatcher::DoWake () override
 
void pw::async2::BasicDispatcher::DoWaitForWake () override
 
bool pw::async2::RunnableDispatcher::RunUntilStalled ()
 
void pw::async2::RunnableDispatcher::RunToCompletion ()
 
void pw::async2::RunnableDispatcher::RunForever ()
 
virtual void pw::async2::RunnableDispatcher::DoWaitForWake ()=0
 

Friends

template<typename >
class pw::async2::RunnableDispatcher::DispatcherForTestFacade
 

Function Documentation

◆ DoWaitForWake() [1/2]

void pw::async2::BasicDispatcher::DoWaitForWake ( )
inlineoverrideprivatevirtual

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.

Implements pw::async2::RunnableDispatcher.

◆ DoWaitForWake() [2/2]

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, and pw::async2::DispatcherForTestFacade< Native >.

◆ DoWake()

void pw::async2::BasicDispatcher::DoWake ( )
inlineoverrideprivatevirtual

Sends a wakeup signal to this Dispatcher.

This method's implementation must ensure that the Dispatcher runs at some point in the future.

DoWake() will only be called once until one of the following occurs:

Note
The impl::dispatcher_lock() may or may not be held here, so it must not be acquired by DoWake, nor may DoWake assume that it has been acquired.

Implements pw::async2::Dispatcher.

◆ 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.