Generator functions implementing this type should only ever yield * to
things that are of Yieldable type, such as a Task,
to() or other generators declared Yieldable. (They can also yield
Suspend values, of course.)
Coroutines run asynchronously, beginning in the microtask after they are
.exec()'d or started. Any result they return or error they
throw will be treated as the result of the task they run in. If the task is
canceled (or completed via another activity), the coroutine will be aborted,
running any finally clauses up to their first yield operation, and then
jumping to the next outer finally clause, until all such clauses have had a
chance to run. Any return value of an aborted coroutine is ignored; any
error is forwarded to a parent scope via Context.asyncThrow(). If
the coroutine uses using statements, these are also cleaned up during
cancellation.
A generator yielding Suspend callbacks
Generator functions implementing this type should only ever
yield *to things that are of Yieldable type, such as a Task, to() or other generators declared Yieldable. (They can also yield Suspend values, of course.)Coroutines run asynchronously, beginning in the microtask after they are .exec()'d or started. Any result they return or error they throw will be treated as the result of the task they run in. If the task is canceled (or completed via another activity), the coroutine will be aborted, running any finally clauses up to their first
yieldoperation, and then jumping to the next outer finally clause, until all such clauses have had a chance to run. Any return value of an aborted coroutine is ignored; any error is forwarded to a parent scope via Context.asyncThrow(). If the coroutine usesusingstatements, these are also cleaned up during cancellation.