hi ``` runBlocking { println("start main") ...
# coroutines
h
hi
Copy code
runBlocking {
      println("start main")
      execute(coroutineContext) {  println("some long operation")  }
      println("main done")
}

fun execute(context: CorouitneContext, action: suspend () -> Unit) {
      action.startCorouitne(Continuation(context + <http://Dispatchers.IO|Dispatchers.IO>) {
            println("corouitne complete")
     })
}
so when execute : start main main done, i expected to see : corouitne complete "startCorouitne" start a new coroutine in my case i bound it to runBlocking scope (with context as parent) and with dispather IO, so i expect to see "coroutine complete" in console ?? i think this new coroutne created by startCoroutine its not bound to runBlocking so when main is finish its ignore this corouitne
l
You should not use
startCoroutine
if you use kotlinx.coroutines. Consider using
withContext
or
launch
instead, if needed.