ThreadPoolDispatcher

class ThreadPoolDispatcher : 
    ExecutorCoroutineDispatcherBase,
    Closeable
(source)

Platform and version requirements: JVM

Dispatches coroutine execution to a thread pool of a fixed size. Instances of this dispatcher are created with newSingleThreadContext and newFixedThreadPoolContext.

Functions

close

fun close(): Unit

Closes this dispatcher – shuts down all threads in this pool and releases resources.

toString

fun toString(): String

Extension Functions

cancel

fun CoroutineContext.cancel(
    cause: Throwable? = null
): Boolean

Cancels Job of this context with an optional cancellation cause. The result is true if the job was cancelled as a result of this invocation and false if there is no job in the context or if it was already cancelled or completed. See Job.cancel for details.

cancelChildren

fun CoroutineContext.cancelChildren(
    cause: Throwable? = null
): Unit

Cancels all children of the Job in this context with an optional cancellation cause. It does not do anything if there is no job in the context or it has no children. See Job.cancelChildren for details.