class MultiThreadExecutor
source · line 9public class MultiThreadExecutor internal constructor(
workerCount: Int,
private val blockingPool: BlockingTaskPool,
private val ownsBlockingPool: Boolean,
drivers: Array<CoroutineWorkerDriver>?
) : CoroutineExecutor, Closeable
- Supertype
CoroutineExecutor - Supertype
Closeable - Inherited
fun dispose(): Unit· Closeable
Runs coroutine work on fixed managed workers and blocking work on a separate pool.
function invokeOnTermination
source · line 38public fun invokeOnTermination(handler: () -> Unit): Disposable
Registers an ordinary termination notification without creating another coroutine.
parameter handler
source · line 38handler: () -> Unit
function requestShutdown
source · line 74public fun requestShutdown(): Unit
Stops admission of new roots, preserving active tasks and their children.
function join
source · line 92public fun join(): Unit
Waits for termination and joins owned threads after shutdown has been requested.
function awaitTermination
source · line 86public suspend fun awaitTermination(): Unit
Waits for accepted work and owned workers; cancellation only ends this wait.
property isShutdown
source · line 33public val isShutdown: Boolean
get: public read-only
Whether shutdown has been requested and new root tasks are rejected.
getter get
source · line 33get(): Boolean
property isTerminated
source · line 35public val isTerminated: Boolean
get: public read-only
Whether tasks and owned workers have left their execution loops.
getter get
source · line 35get(): Boolean
function registerTask
source · line 42public override fun registerTask(parent: ExecutorTask?): ExecutorTask
- Overrides
registerTask
Registers a root while open, or a child of this executor's active parent while draining.
parameter parent
source · line 42parent: ExecutorTask?
function close
source · line 106public override fun close(): Unit
- Overrides
close
Requests shutdown and joins; cannot be called by work that must itself finish.