Interface IRunLoop
interface IRunLoop
Extends com.amazon.apmf.IStandard
An IRunLoop is a task-processing loop running on a thread. This interface provides
functions to allow callers to run tasks synchronously or asynchronously. Asynchronous tasks may
be scheduled to run in the future and designated as repeating or only executing one time.
Methods
runTask()
Runs anvoidrunTask(ITask*task,TaskPriority?taskPriority)
ITask synchronously. If the IRunLoop’s task queue is not empty, the
task will be added to the queue in TaskPriority order. Calling this function will
block the caller’s thread until execution of the requested ITask is finished.
Parameters
task
ITask* — Required
ITask to be executed.
taskPriority
TaskPriority? — Optional
Optional TaskPriority specifying the priority in which
ITask needs to be executed. If not specified the default TaskPriority is
“DEFAULT”.
scheduleTask()
Schedules ancom.amazon.apmf.UuidscheduleTask(ITask*task,TaskPriority?taskPriority,com.amazon.apmf.MonotonicDuration?afterDelay,boolrepeating)
ITask to be executed asynchronously. A unique identifier for the
scheduled task is returned and can be used in a subsequent call to cancel the request
(See IRunLoop::scheduleTask ).
Parameters
task
ITask* — Required
ITask to be executed.
taskPriority
TaskPriority? — Optional
Optional TaskPriority specifying the priority in which
ITask needs to be executed. If not specified the default TaskPriority is
“DEFAULT”.
afterDelay
com.amazon.apmf.MonotonicDuration? — Optional
Optional parameter which specify the delay after which the
ITask will be scheduled for execution. Default value is zero seconds.
repeating
bool — Required
When true, the ITask is repeated until cancelled. When false,
the ITask is executed only once.
Returns
com.amazon.apmf.Uuid
Uuid representing the unique identifier for the scheduled ITask.
cancelTask()
Cancels a scheduledvoidcancelTask(com.amazon.apmf.UuidtaskId)
ITask. The behavior of canceling a scheduled task that has
already begun execution is implementation specific.
Parameters
taskId
com.amazon.apmf.Uuid — Required
Uuid of the scheduled ITask to cancel.

