think of it as cooperative looping...children have...
# coroutines
k
think of it as cooperative looping...children have to check a flag to exit their loops
e
So there's no way for a parent to stop the execution of its children if these are doing some blocking stuffs ?
k
Read above again 😀
e
So basically a boolean flag. Let me try it and see what it gives.
d
No, check
isActive
inside the coroutine, it tells you if it's supposed to cancel, or just call a suspend fun like yield()...
☝️ 3
e
@dave08 I may need more context. Have a look at the code I posted, put some modifications. That might be helpful.
There must be some point in your calculation that you can check this, like in looping...
m
Generally it could be very unsafe to just cancel some work, without cooperation of the worker. Java future (old version) has this, though thread doing work can defend against it (uninterruptable). Newer completableFuture, opt out of cancellation completely, when you call cancel on a completable future it does NOTHING to the currently working thread, just cancels the future. So I am happy with getting any support for cancellations in coroutines, I think it is done elegantly