C/C++ API Reference
Loading...
Searching...
No Matches
pw::async2::DispatcherForTestFacade< Native > Class Template Referencefinal

Overview

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

DispatcherForTestFacade defines the interface for DispatcherForTest. Backends must provide:

  • A pw_async2_backend/native_dispatcher_for_test.h header.
  • A class or alias named pw::async2::backend::NativeDispatcherForTest that:
Inheritance diagram for pw::async2::DispatcherForTestFacade< Native >:
pw::async2::RunnableDispatcher pw::async2::Dispatcher

Public Member Functions

 DispatcherForTestFacade ()=default
 DispatcherForTest is default constructible.
 
 DispatcherForTestFacade (const DispatcherForTestFacade &)=delete
 
DispatcherForTestFacadeoperator= (const DispatcherForTestFacade &)=delete
 
 DispatcherForTestFacade (DispatcherForTestFacade &&)=delete
 
DispatcherForTestFacadeoperator= (DispatcherForTestFacade &&)=delete
 
void AllowBlocking ()
 
template<typename Pendable >
Poll< internal::PendOutputOf< Pendable > > RunInTaskUntilStalled (Pendable &pendable)
 
void RunToCompletionUntilReleased ()
 
void Release ()
 
uint32_t tasks_polled () const
 
uint32_t tasks_completed () const
 Returns the total number of tasks the dispatcher has run to completion.
 
uint32_t wake_count () const
 Returns the total number of times the dispatcher has been woken.
 
- Public Member Functions inherited from pw::async2::RunnableDispatcher
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

void DoWake () override
 
void DoWaitForWake () override
 

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

◆ AllowBlocking()

template<typename Native >
void pw::async2::DispatcherForTestFacade< Native >::AllowBlocking ( )
inline

Whether to allow the dispatcher to block by calling DoWaitForWake. RunToCompletion may block the thread if there are no tasks ready to run.

◆ DoRunUntilStalled()

template<typename Native >
bool pw::async2::DispatcherForTestFacade< Native >::DoRunUntilStalled ( )
overrideprivatevirtual

Reimplemented from pw::async2::RunnableDispatcher.

◆ DoWaitForWake()

template<typename Native >
void pw::async2::DispatcherForTestFacade< Native >::DoWaitForWake ( )
overrideprivatevirtual

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.

◆ DoWake()

template<typename Native >
void pw::async2::DispatcherForTestFacade< Native >::DoWake ( )
overrideprivatevirtual

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 internal::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.

◆ Release()

template<typename Native >
void pw::async2::DispatcherForTestFacade< Native >::Release ( )

Release() allows a RunToCompletionUntilReleased call in a different thread to complete. Release() must be called exactly once per RunToCompletionUntilReleased call.

◆ RunToCompletionUntilReleased()

template<typename Native >
void pw::async2::DispatcherForTestFacade< Native >::RunToCompletionUntilReleased ( )

Runs the disptacher until all tasks have completed and DispatcherForTest::Release has been called. This allows a test to wait until a series of steps complete, independent of the tasks registered at a particular time.

Release() must be called exactly once per RunToCompletionUntilReleased call on a different thread.

◆ tasks_polled()

template<typename Native >
uint32_t pw::async2::DispatcherForTestFacade< Native >::tasks_polled ( ) const
inline

Returns the total number of times the dispatcher has called a task's Pend() method.


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