Pigweed
 
Loading...
Searching...
No Matches
pw::async::FunctionDispatcher Class Referenceabstract

#include <function_dispatcher.h>

Inheritance diagram for pw::async::FunctionDispatcher:
pw::async::Dispatcher pw::chrono::VirtualClock< SystemClock > pw::async::HeapDispatcher

Public Member Functions

virtual Status Post (TaskFunction &&task_func)
 Post dispatcher owned |task_func| function.
 
virtual Status PostAfter (TaskFunction &&task_func, chrono::SystemClock::duration delay)
 Post dispatcher owned |task_func| function to be run after |delay|.
 
virtual Status PostAt (TaskFunction &&task_func, chrono::SystemClock::time_point time)=0
 Post dispatcher owned |task_func| function to be run at |time|.
 
virtual void Post (Task &task)
 
virtual void PostAfter (Task &task, chrono::SystemClock::duration delay)
 
virtual void PostAt (Task &task, chrono::SystemClock::time_point time)=0
 
- Public Member Functions inherited from pw::async::Dispatcher
virtual void Post (Task &task)
 
virtual void PostAfter (Task &task, chrono::SystemClock::duration delay)
 
virtual void PostAt (Task &task, chrono::SystemClock::time_point time)=0
 
virtual bool Cancel (Task &task)=0
 
- Public Member Functions inherited from pw::chrono::VirtualClock< SystemClock >
virtual SystemClock::time_point now ()=0
 Returns the current time.
 

Additional Inherited Members

- Static Public Member Functions inherited from pw::chrono::VirtualClock< SystemClock >
static VirtualClock< SystemClock > & RealClock ()
 Returns a reference to the real system clock to aid instantiation.
 

Detailed Description

FunctionDispatcher extends Dispatcher with Post*() methods that take a TaskFunction instead of a Task. This implies that Tasks are allocated or are taken from a Task pool. Tasks are owned and managed by the Dispatcher.

Member Function Documentation

◆ Post()

virtual void pw::async::Dispatcher::Post ( Task task)
inlinevirtual

Post caller-owned |task| to be run on the dispatch loop.

Posted tasks execute in the order they are posted. This ensures that tasks can re-post themselves and yield in order to allow other tasks the opportunity to execute.

A given |task| must only be posted to a single Dispatcher.

Reimplemented from pw::async::Dispatcher.

◆ PostAfter()

virtual void pw::async::Dispatcher::PostAfter ( Task task,
chrono::SystemClock::duration  delay 
)
inlinevirtual

Post caller owned |task| to be run after |delay|.

If |task| was already posted to run at an earlier time (before |delay| would expire), |task| must be run at the earlier time, and |task| may also be run at the later time.

Reimplemented from pw::async::Dispatcher.

◆ PostAt() [1/2]

virtual void pw::async::Dispatcher::PostAt ( Task task,
chrono::SystemClock::time_point  time 
)
virtual

Post caller owned |task| to be run at |time|.

If |task| was already posted to run before |time|, |task| must be run at the earlier time, and |task| may also be run at the later time.

Implements pw::async::Dispatcher.

◆ PostAt() [2/2]

virtual Status pw::async::FunctionDispatcher::PostAt ( TaskFunction &&  task_func,
chrono::SystemClock::time_point  time 
)
pure virtual

Post dispatcher owned |task_func| function to be run at |time|.

Implemented in pw::async::HeapDispatcher.


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