#include <PhxClock.h>
Inheritance diagram for Phx::Clock::Task:

Public Member Functions | |
| virtual double | nextTime (void) const =0 |
| Returns the next time at which the task will invoke the installed listener. | |
| virtual void | nextTime (double nextTime)=0 |
| Sets the next time at which this task will be called back by the clock. | |
| virtual double | time (void) const =0 |
| Retrieves the current reported time of the Clock to which this task is attached. | |
| virtual void | listener (Listener *listener)=0 |
| Sets the listener that this Task will call back when its parent clock reaches time(). | |
| virtual String | name (void) const =0 |
| Returns the name of this task, as specified in the call to Clock::newTask(). | |
| virtual void | affinity (uint32_t affinity)=0 |
| Sets the affinity for this Task. | |
| virtual uint32_t | affinity (void) const =0 |
| Returns the current affinity for this Task. | |
Static Public Attributes | |
| static const uint32_t | AFFINITY_NONE |
| A constant for the affinity() attribute that specifies the task has no affinity for a particular thread. | |
| static const uint32_t | AFFINITY_MAIN_THREAD |
| A constant for the affinity() attribute that specifies the task has affinity for the main thread. | |
| static const double | NEVER |
| A constant that indicates that a task as not scheduled to run again. | |
Classes | |
| class | Listener |
| A listener type which can be called back by the Clock task. More... | |
The client can install a Task::Listener into a Task interface. When the time() attribute of the Clock this Task is attached to is greater or equal to the Task's nextTime() attribute, the listener installed in the task will have its onTimeout method invoked.
|
|
Returns the current affinity for this Task. The default is AFFINITY_NONE, specifying that this task may run on any thread. This is the most efficient setting if no particular thread needed. |
|
|
Sets the affinity for this Task.
The affinity of a task specifies to the scheduler that the Task should be run on a particular thread. Thread 0 is the main thread, while threads 1..N-1 are the N-1 worker threads. If
|
|
|
Sets the next time at which this task will be called back by the clock.
task->nextTime(0); // schedule listener call immediately. task->nextTime(0); // schedules another listener call. // Did this break idempotence? task->nextTime(0); // schedule listener call immediately. // nextTime() == NEVER now because @p nextTime < time() // in the above call. task->nextTime(Clock::Task::NEVER); // this does nothing by idempotence with respect to the above. task->nextTime(0); // changes nextTime() to 0 from NEVER // nextTime() == NEVER again.
Certainly, the following is idempotent in the usual sense -- nothing is atypical if // Assume: later > task->time() for duration of this code. task->nextTime(later); //fine: task->nextTime() == later task->nextTime(later); //does nothing, by idempotence. task->nextTime(Clock::Task::NEVER); // Cancels call. // listener has not been invoked by this point and is not // scheduled to be invoked. |
|
|
Returns the next time at which the task will invoke the installed listener. The time is based on the underlying Clock for this Task. The nextTime() attribute is set to NEVER if the next pending listener invocation is not scheduled for a finite time later than time(). Put another way, NEVER is the time at which the next callback will occur once all callbacks prior or at the present time have been dispatched (which means they are in the process of being called, even though the actual function call may not yet have been made). A simple consequence of this behavior is that nextTime() > time() at every instant.
|
|
|
Retrieves the current reported time of the Clock to which this task is attached.
|
|
|
A constant for the affinity() attribute that specifies the task has affinity for the main thread. This constant is guaranteed to be 0, and may be used instead of hard-coded value for clarity. |
1.4.2