kingsley
03/31/2017, 10:41 AMfun retrieveUserInfo(userId: String) = launch(UI) {
val deferred = async(CommonPool) { api.retrieveUserById(userId) }
val userInfo = deferred.await()
// Use userInfo here
}
Meanwhile, suspend fun
doesn't necessarily block the main thread. Calling the fun
from a non main thread context for example