The cancelation decorator that I’m writing has two...
# coroutines
e
The cancelation decorator that I’m writing has two entry points. One is via an optional dispatcher parameters to async, so you could do:
Copy code
async(Cancellable()) { … }
or, if you have your own single-threaded dispatcher, for example,
Copy code
async(Cancellable(myDispatcher)) { … }
The other entry points are via suspending functions, like
withTimeout
, so that inside a coroutine you can write
Copy code
withTimeout(myTimeout) { … }
and if the block inside the coroutine times out, it will abort this particular block, but not the outer coroutine. I think I can make them properly-nesting at any level.