https://kotlinlang.org logo
#coroutines
Title
# coroutines
i

itasyurt

02/22/2019, 3:16 PM
Hello, I have a question about fixed thread pools. I see that fixed thread pools are now obsolete https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/new-fixed-thread-pool-context.html Is there any suggested way to replace this? or should we continue with newFixedThredPoolContext (or java style executors) (Sorry for crospostng from #general)
w

withoutclass

02/22/2019, 3:19 PM
I believe it’s still correct to do
Executors.newFixedThreadPool(COUNT).asCoroutineDispatcher()
i

itasyurt

02/22/2019, 3:23 PM
Thanks. So what we do is using the Java convention enhanced with an extension function right?
w

withoutclass

02/22/2019, 3:26 PM
Yes, with the
asCoroutineDispatcher()
extension, a Java
Executor
can be converted in to a dispatcher
i

itasyurt

02/22/2019, 3:30 PM
Thank you very much, it was very helpful. that was something I was googling for hours.
w

withoutclass

02/22/2019, 3:31 PM
You’re welcome 🙂
2 Views