Room 2.6.1 would ignore thread interruption. It's safe to interrupt caller thread
val threadFromPool = thread {
val result = dao.select()
}
threadFromPool.interrupt()
Newer version use coroutines, even DAO method can be interrupted. Now I have to start a new thread to do database operation to prevent caller thread interrupted.
val threadFromPool = thread {
// no result
thread {
dao.select()
}
}
threadFromPool.interrupt()
Problem, how to let database operations to be finished even caller thread get interrupted?
Description
Version used: 2.7.0-rc02
Room 2.6.1 would ignore thread interruption. It's safe to interrupt caller thread
Newer version use coroutines, even DAO method can be interrupted. Now I have to start a new thread to do database operation to prevent caller thread interrupted.
Problem, how to let database operations to be finished even caller thread get interrupted?