``` val queue = BlockingQueue<List<int>&g...
# coroutines
m
Copy code
val queue = BlockingQueue<List<int>>() // or some other type
val outQueue = BlockingQueue<...>()
val executor = Executors.newFixedThreadPool(4) // sized appropriately  for your system. See Runtime class for # of CPUs
repeat(4) { executor.submit { 
while(true) {
val i = queue.take()
if (i.isEmpty()) {
return
}
outQueue.put(slowCalculation(i))
}}}