you make suspending what you want to be cancelable
marking blocking code thats not cancelable with suspend does nothing
however if you mark it suspend, then by convention it should be main-safe, so yea apply dispatcher then
u
uli
05/08/2021, 8:31 AM
@pablo do both. Make a suspend function that switches context. This way your function is main safe and the caller does not have to care.
As @ursus said, you could also make it cancelable by checking is active or calling yield regularly. But that will most likely have some performance impact. You have to judge