Io module

cancel

procedureextensionexperimentalSource

Makes the blocking calls of fiber return .CANCELED, now and from now on. The call it is blocked in, if any, returns at once. Does nothing for a fiber that has ended.

Example↗
Io :: #import "Extensions/Io";

Io.io_run(() {
    sleeper := Io.spawn(() {
        error := Io.sleep(60_000);
        assert(error == .CANCELED);
    });

    Io.yield();             // let it start sleeping
    Io.cancel(sleeper);
});
cancel :: (handle: Fiber_Handle)

Parameters

handle: Fiber_Handle

See also