#include <heap_dispatcher.h>
Public Member Functions | |
HeapDispatcher (Dispatcher &dispatcher) | |
Status | PostAt (TaskFunction &&task_func, chrono::SystemClock::time_point time) override |
Post dispatcher owned |task_func| function to be run at |time|. | |
void | PostAt (Task &task, chrono::SystemClock::time_point time) override |
bool | Cancel (Task &task) override |
chrono::SystemClock::time_point | now () override |
Returns the current time. | |
![]() | |
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 |
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 |
virtual SystemClock::time_point | now ()=0 |
Returns the current time. | |
Additional Inherited Members | |
![]() | |
static VirtualClock< SystemClock > & | RealClock () |
Returns a reference to the real system clock to aid instantiation. | |
HeapDispatcher wraps an existing Dispatcher and allocates Task objects on the heap before posting them to the existing Dispatcher. After Tasks run, they are automatically freed.
|
inlineoverridevirtual |
Prevent a Post
ed task from starting.
Returns: true: the task was successfully canceled and will not be run by the dispatcher until Post
ed again. false: the task could not be cancelled because it either was not posted, already ran, or is currently running on the Dispatcher
thread.
Implements pw::async::Dispatcher.
|
inlineoverridevirtual |
Returns the current time.
Implements pw::chrono::VirtualClock< SystemClock >.
|
inlineoverridevirtual |
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.
|
overridevirtual |
Post dispatcher owned |task_func| function to be run at |time|.
Implements pw::async::FunctionDispatcher.