ScheduledDispatchQueue

class ScheduledDispatchQueue(poolSize: Int) : DispatchQueue

A DispatchQueue that uses a ScheduledThreadPoolExecutor to schedule tasks to be executed in the future.

Uses a default pool size of 8. Custom values can be provided during construction

Constructors

ScheduledDispatchQueue
Link copied to clipboard
fun ScheduledDispatchQueue(poolSize: Int = 8)

Functions

queue
Link copied to clipboard
open override fun queue(delay: Long, unit: TimeUnit, runnable: () -> Unit): DispatchWorkItem
Queue a Runnable to be executed after a given time unit delay
queueAtFixedRate
Link copied to clipboard
open override fun queueAtFixedRate(delay: Long, period: Long, unit: TimeUnit, runnable: () -> Unit): DispatchWorkItem
Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence after initialDelay, then initialDelay + period, then initialDelay + 2 * period, and so on.