https://kotlinlang.org logo
#coroutines
Title
# coroutines
c

christophsturm

12/22/2020, 11:45 AM
how can i call launch from a suspend method method and not wait for it? if i wrap the launch call with coroutineScope {} it waits for the job to finish
l

louiscad

12/22/2020, 11:49 AM
You need a different scope since you want to escape structured concurrency.
4
c

christophsturm

12/22/2020, 12:13 PM
can i just pass the scope that runBlocking creates around or is that a terrible idea?
l

louiscad

12/22/2020, 12:14 PM
@christophsturm If that
runBlocking
is the one from the
main
function, it's not a bad idea. You need to ensure the
runBlocking
is supposed to live at least as long as the coroutine you want to launch.
c

christophsturm

12/22/2020, 12:16 PM
thanks. thats exactly what i want then
2 Views