newSingleThreadContext

@ObsoleteCoroutinesApi fun newSingleThreadContext(
    name: String
): ExecutorCoroutineDispatcher
(source)

Platform and version requirements: JVM

Creates a coroutine execution context using a single thread with built-in yield support. NOTE: The resulting ExecutorCoroutineDispatcher owns native resources (its thread).Resources are reclaimed by ExecutorCoroutineDispatcher.close.

NOTE: This API will be replaced in the future. A different API to create thread-limited thread pools that is based on a shared thread-pool and does not require the resulting dispatcher to be explicitly closed will be provided, thus avoiding potential thread leaks and also significantly improving performance, due to coroutine-oriented scheduling policy and thread-switch minimization. See issue #261 for details. If you need a completely separate thread-pool with scheduling policy that is based on the standard JDK executors, use the following expression: Executors.newSingleThreadExecutor().asCoroutineDispatcher(). See Executor.asCoroutineDispatcher for details.

Parameters

name - the base name of the created thread.