CloseableCoroutineDispatcher

expect abstract class CloseableCoroutineDispatcher : CoroutineDispatcher

CoroutineDispatcher that provides a method to close it, causing the rejection of any new tasks and cleanup of all underlying resources associated with the current dispatcher. Examples of closeable dispatchers are dispatchers backed by java.lang.Executor and by kotlin.native.Worker.

The CloseableCoroutineDispatcher class is not stable for inheritance in 3rd party libraries, as new methods might be added to this interface in the future, but is stable for use.

actual abstract class CloseableCoroutineDispatcher : CoroutineDispatcher
actual typealias CloseableCoroutineDispatcher = ExecutorCoroutineDispatcher
actual abstract class CloseableCoroutineDispatcher : CoroutineDispatcher

Constructors

CloseableCoroutineDispatcher
Link copied to clipboard
expect fun CloseableCoroutineDispatcher()
actual fun CloseableCoroutineDispatcher()
actual fun CloseableCoroutineDispatcher()

Functions

close
Link copied to clipboard
expect abstract fun close()

Initiate the closing sequence of the coroutine dispatcher. After a successful call to close, no new tasks will be accepted to be dispatched, but the previously dispatched tasks will be run.

actual abstract fun close()
actual abstract fun close()

Sources

common source
Link copied to clipboard
js source
Link copied to clipboard
native source
Link copied to clipboard