schedule

fun schedule(r: Runnable, period: Long, delay: Long = 0)

Submits a periodic action to the thread pool that becomes enabled first after the given initial delay, and subsequently with the given period.

If the current task is not completed and the next task should be executed at this time, the next task will be executed immediately after the current task is executed to ensure that the number of executions is correct as much as possible.

Parameters

r

the action.

period

the period between each execution.

delay

the initial delay.