We tried to deploy some of the coroutine code to o...
# coroutines
v
We tried to deploy some of the coroutine code to our application backend (several hundred concurrent API requests per second) and struggle a little bit. Aren't these two functions exchangeable? Where is the exact difference between them (not in their implementation, but in their usage as application developer)?
Copy code
fun runAsync1(task: () -> Unit) {
  thread {
    try { task() }
    catch (e: Exception) { e.printStackTrace() }
  }
}

fun runAsync2(task: suspend CoroutineScope.() -> Unit) {
  launch(CommonPool, start = true) {
    try { task() }
    catch (e: Exception) { e.printStackTrace() }
  }
}
­čĹŹ 2