Hi, if I have a suspend function where inside I ex...
# coroutines
a
Hi, if I have a suspend function where inside I execute a function which requires a lambda not suspend (I'm using a Java library), but I want to execute lambda things inside Do I have to add
runBlocking { //code }
everytime or is there a way to intercept the upper suspend ?
u
turn your java async api into suspend function with
suspendCancelableCoroutine
z
You can grab the coroutine context from the outer suspend function and launch coroutines on it from inside the non-suspend function. You can't join on those coroutines though. runBlocking could get you into trouble depending on which thread the non-suspend code is executing on.