reactormonk
12/23/2024, 2:04 PMsuspendCancellableCoroutine
, does the invokeOnCancellation
get called when I call resume
normally, or should I clean up there as well?kevin.cianfarini
12/23/2024, 2:15 PMinvokeOnCancellation
and the cancelation handler provided in resume
?ephemient
12/23/2024, 6:22 PMinvokeOnCancellation
callback gets invoked when the continuation is cancelled
resume.onCancellation
callback gets invoked when you try to resume
after cancellation
it's possible for only 1 to happen, or 1 then 2 to happenkevin.cianfarini
12/23/2024, 6:45 PMreactormonk
12/24/2024, 1:41 PMDmitry Khalanskiy [JB]
01/07/2025, 2:25 PMsynchronously invoked on cancellation (regular or exceptional) of this continuation
This handler is also called when this continuation resumes normally (with a value) and then is cancelled while waiting to be dispatched. More generally speaking, this handler is called whenever the caller of suspendCancellableCoroutine is getting a CancellationException.So, after a normal
resume
, the handler can only be called if cancellation happened anyway.