Answer the question
In order to leave comments, you need to log in
How to choose whether to create a thread or a coroutine?
When I want to execute some code without slowing down the main thread, how do I choose whether to create a thread or a coroutine?
What features should the code have so that I can confidently say that it should be in a coroutine, and not in another thread, and vice versa?
Answer the question
In order to leave comments, you need to log in
You never need to create a flow with your hands. As a last resort, use a thread pool.
If you use coroutines, use coroutines. With the right controller. In your case, running on Dispatchers.Default will do . There's just a thread pool on the JVM under the hood.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question