Defined in:General base class for objects which can be scheduled to perform a task after a specific amount of time.
class DeferredTask : public ListElement<DeferredTask>, public Completable<DeferredTask>
||Returns the task flags.|
||Sets the task flags.|
DeferredTask(CompletionCallback *callback, void *cookie = nullptr);
||The callback to invoke when the task is triggered.|
||The cookie that is passed to the trigger callback as its last parameter.|
DeferredTaskclass encapsulates a callback function that is invoked at some future time when the deferred task object is triggered by some means. Once a deferred task or one of its subclasses has been created, it should be added to the Time Manager using the
TimeMgr::AddTaskfunction. The callback function specified by the
callbackparameter should have the following prototype.
When the deferred task is triggered, the callback is invoked with the pointer specified by the
typedef void CompletionCallback(DeferredTask *, void *);
cookieparameter passed to it as its second argument. By default, a deferred task is triggered only once and is then removed from the Time Manager. A deferred task can be made to be triggered repeatedly by setting the
kTaskRepeatingflag with the
DeferredTaskbase class is always triggered, so the callback function will be invoked at the beginning of the next frame once the deferred task object has been registered using the
TimeMgr::AddTaskfunction. See the
Timerclass for a deferred task that is triggered after a specified period of time.
Deferred tasks can be persistent or nonpersistent. A persistent task continues to exist after it has been triggered, but a nonpersistent task is automatically destroyed after being triggered. By default, a deferred task is persistent. The persistence state can be changed using the
||Used internally by the Time Manager.|
||The completion callback is called when the task is triggered.|