I have what I think is a simple question and I can think of a couple of ways to do it but I wanted to know what the most idiomatic way to go about it would be.
Say I have a suspending function which is running on the common pool and I'm going to call another suspending function which is IO intensive (so I want to run it on another pool more suited to that, say ioPool) and then immediately following that I am going to do something CPU intensive so I want to be on the common pool again.
suspend fun someFun() {
// On commonPool
val users = ioIntensiveSuspending() // On ioPool
cpuIntensiveSuspending(users) // On commonPool
}
What is the best most idiomatic way to achieve that switch?