Last active
September 16, 2022 13:15
-
-
Save aleksandarzekovic/52b64a214a6de07945db0c06a3824e41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JvmStatic | |
public actual val Default: CoroutineDispatcher = DefaultScheduler | |
internal object DefaultScheduler : SchedulerCoroutineDispatcher( | |
CORE_POOL_SIZE, MAX_POOL_SIZE, | |
IDLE_WORKER_KEEP_ALIVE_NS, DEFAULT_SCHEDULER_NAME | |
) { | |
... | |
} | |
internal open class SchedulerCoroutineDispatcher( | |
private val corePoolSize: Int = CORE_POOL_SIZE, | |
private val maxPoolSize: Int = MAX_POOL_SIZE, | |
private val idleWorkerKeepAliveNs: Long = IDLE_WORKER_KEEP_ALIVE_NS, | |
private val schedulerName: String = "CoroutineScheduler", | |
) : ExecutorCoroutineDispatcher() { | |
... | |
override fun dispatch(context: CoroutineContext, block: Runnable): Unit = coroutineScheduler.dispatch(block) | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment