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