For dealing with database transactions, I understa...
# coroutines
n
For dealing with database transactions, I understand using a thread pool is the best way to go, since the transactions are blocking. To make it suspension friendly, I have a dispatcher:
Copy code
val DB = Executors.newCachedThreadPool(object : ThreadFactory {
	var i = 0
	override fun newThread(r: Runnable?) = Thread("db-${i++}")
}).asCoroutineDispatcher()
If I use it like this:
Copy code
launch(DB) {
   val records = ...;
   // A
}
Will code in
A
be tying up threads from the dispatcher?