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

Luke

03/22/2023, 2:44 PM
In a suspend function, is there a way to check if the calling coroutine is cancelled?
delay
is accessible and does check the cancellation status so there must be a way right?
s

Sam

03/22/2023, 2:45 PM
Yes, you can do
coroutineContext.job?.isActive
l

Luke

03/22/2023, 2:47 PM
Thanks for the quick answer!
e

elizarov

03/22/2023, 8:52 PM
coroutineContext.isActive
does the same trick. No need to explicitly find its
job
.
4 Views