Marc Knaup05/26/2020, 9:31 AM
check for cancelation upon before and/or after invoking
check for cancelation immediately or on/after dispatch?
bezrukov05/26/2020, 10:07 AM
Will a suspending function call check for cancelation before the function implementation is invoked?it's heavily depends on suspend fun implementation, by default suspend fun is not cancellable out of the box, so it needs to be designed to support cooperative cancellation (e.g. use built-in primitives or check for coroutine state).
WillShould be both in generalcheck for cancelation upon before and/or after invoking
Willcheck for cancelation immediately or on/after dispatch?
will check it immediately, but will also resumed with exception if job was cancelled before re-dispatching. Also consider
for checking for cancellation in your non-cancellable code
Marc Knaup05/26/2020, 10:15 AM
. That seems helpful given that
don’t check for cancelation by default (unless it calls others that do). Do you happen to know a good open source example/library/app that properly manages various scopes & contexts and thus can serve as guidance?
louiscad05/26/2020, 12:08 PM
since I don't recall which kotlinx.coroutines version does check for cancellation before and after invoking block using its given context (which, in case of
, will be prevented).
uli05/26/2020, 2:28 PM
, and funs calling one of the above. what did i forget?
octylFractal05/26/2020, 5:10 PM
louiscad05/26/2020, 7:26 PM
. FYI, the "x" in kotlinx stands for extension.
octylFractal05/26/2020, 8:14 PM
louiscad05/26/2020, 8:58 PM
Marc Knaup05/27/2020, 7:16 AM