The best approach I can think of consist of the fo...
# coroutines
e
The best approach I can think of consist of the following steps: 1. Use
val fileContext = newFixedThreadPoolContext(n)
to create a separate thread pool for your file operations. 2. Whenever you need to do a file op from some other coroutine, use
run
to switch into the fileContext:
Copy code
run(fileContext) { 
   // do blocking file ops here
}
The coroutine that invokes
run
will get suspended until the blocking file operation in your pool completes.
😍 1