I'm currently working on a codebase that is using runBlocking in a lot of places.
Here is an example
fun doSomeComputation() {
val rows = runBlocking { //suspend function which queries database }
//rows is used for further computation
}
From what I understand runBlocking blocks the current thread. So what is the benefit we are exactly getting by using it instead of using regular function? Read somewhere we use async code so that thread is not blocked and UI doesn't become unresponsive but how is using runBlocking async code since it is blocking the thread?
I had the same doubt in javascript async/await
Since thread gets blocked why even use await?