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

obobo

02/27/2019, 7:16 PM
What's the right way for setting off a 'fire and forget' Job via
launch
? Should I just instance a new scope for the call? Documentation says that any uncaught exceptions will cancel the parent job.
z

zak.taccardi

02/27/2019, 7:17 PM
you can use
GlobalScope
if you aren’t interested in tracking its Job for cancellation
d

Dico

02/27/2019, 7:17 PM
sorry
o

obobo

02/27/2019, 7:18 PM
Okay, that's what I was wondering, thanks.
n

nwh

02/27/2019, 7:22 PM
Uncaught exceptions will cancel a parent job unless it's a
SupervisorJob
, I believe
👍 1
b

bdawg.io

02/27/2019, 9:05 PM
GlobalScope
behaves similarly to a supervisor scope by virtue of there being no
Job
attached to cancel peers when an uncaught exception occurs
s

sitepodmatt

02/28/2019, 3:23 AM
GlobalScope.launch { println(this.coroutineContext[Job]) }
it still has a Job but job has no parent
d

Dico

02/28/2019, 5:07 AM
He meant that theres no parent attached to the GlobalScope, I.e. no parent to the coroutine
16 Views