https://kotlinlang.org logo
Title
s

Slackbot

07/04/2019, 3:54 AM
This message was deleted.
t

tseisel

07/04/2019, 6:48 AM
By "computational operations", the docs states "any blocking operation that can take some time to complete", for example disc/network IO, scientific computation, data filtering, etc. In order to write suspend functions that are cancellable, you have to : - call other suspend functions that support cancellation (it is often indicated in their documentation) - check that the coroutine is still active, and either throw
CancellationException
(
ensureActive()
) or make the block complete early (just like with
Thread
cancellation).
d

Dico

07/04/2019, 10:14 AM
You can start a coroutine atomically or with
NonCancellable
context to make it not cancel by cancellation in the middle of the coroutine. I think.