Single Thread Context
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.
If the resulting dispatcher is closed and attempt to submit a continuation task is made, then the Job of the affected task is cancelled and the task is submitted to the Dispatchers.IO, so that the affected coroutine can cleanup its resources and promptly complete.
This is a delicate API. The result of this method is a closeable resource with the associated native resources (threads). It should not be allocated in place, should be closed at the end of its lifecycle, and has non-trivial memory and CPU footprint. If you do not need a separate thread-pool, but only have to limit effective parallelism of the dispatcher, it is recommended to use CoroutineDispatcher.limitedParallelism instead.
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.
the base name of the created thread.