phasync
Manual / Cancellation and cleanup

Manual

Cancellation and cleanup

Cancel a coroutine, interrupt its wait, and run code when it ends.

Introduction#

phasync::cancel throws a CancelledException into a coroutine at its next wait; Frame::cancel does the same to every coroutine of a frame, deepest first. phasync::finally callbacks always run, cancellation included, and their own waits are shielded from it; phasync::shielded does the same for cleanup outside a finally block. See Advanced: Coroutines for the rules cancellation follows.

Examples#

Reference#