You can just reuse Coroutines Default dispatcher, it also has pool of availableProcessors + 1 threads
ā 1
One more way: create a thread executor and convert it to Coroutines dispatcher
But if you really want to migrate this code to Coroutines, I would Instead do that for code running inside of those thread, maybe you can optimize it and do not create so many thread and be non-blocking instead