Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

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()

void runTask(ITask* task, TaskPriority? taskPriority)
Runs an 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()

com.amazon.apmf.Uuid scheduleTask(ITask* task, TaskPriority? taskPriority, com.amazon.apmf.MonotonicDuration? afterDelay, bool repeating)
Schedules an 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()

void cancelTask(com.amazon.apmf.Uuid taskId)
Cancels a scheduled 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.
Last modified on October 29, 2026