Currently I have a `suspend fun <http://CoroutineC...
# coroutines
p
Currently I have a
suspend fun <http://CoroutineContext.xyz|CoroutineContext.xyz>()
and I perform a check and then call
coroutineContext.cancel()
and then throw a
CancellationException
.
a
What do you mean by check? Also note that whenever you switch contexts (withContext), the runnables will automatically not be called if the coroutine is cancelled
a
If you also just want to insert breakpoints during an execution, you can use
yield()
p
So you suggest to just throw the exception?
a
Throwing alone should work
You also might not want to use both
suspend
and
CoroutineScope
extensions in one method. Suspending functions are long executions whereas coroutine scope functions launch and return quickly
p
It was only to cancel the job
Thanks!