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)=0 |
| 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)=0 |
| 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. | |
|
virtual |
Post |task| to be run as soon as possible.
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.
If the task is already posted and due to run immediately, this call is a no-op and the task's position in the queue is preserved. If the task is already posted but for a future time, it is moved to run immediately.
Implements pw::async::Dispatcher.
Reimplemented in pw::async::HeapDispatcher.
|
inlinevirtual |
Post caller-owned |task| to be run after |delay|.
If |task| is already posted to this Dispatcher, it is canceled and re-posted to execute at the new time (now + |delay|).
Reimplemented from pw::async::Dispatcher.
|
virtual |
Post caller-owned |task| to be run at |time|.
If |task| is already posted to this Dispatcher, it is canceled and re-posted to execute at the new |time|.
Implements pw::async::Dispatcher.