elizarov
09/28/2017, 9:20 AMn
).
2. Define your own context for SQL operations like this: val SQL = newFixedThreadPoolContext(n, "SQL")
3. Wrap your SQL operations into run(SQL) { ... }
invocation. It works best if you ecapsulate them in suspending functions like this:
suspend fun mySqlOperation(params) = run(SQL) { .... }
Now you can use those suspending functions from coroutines and it will not block anything.