So a cancelable function must poll the `cancelRequested` function, and return the error `Canceled`, right?
https://github.com/ziglang/zig/blob/master/lib/std/Io.zig#L1...
https://github.com/ziglang/zig/blob/master/lib/std/Io.zig#L7...
So a cancelable function must poll the `cancelRequested` function, and return the error `Canceled`, right?
https://github.com/ziglang/zig/blob/master/lib/std/Io.zig#L1...
https://github.com/ziglang/zig/blob/master/lib/std/Io.zig#L7...
In the vast majority of cases, cancellation will be handled transparently by virtue of `try` being commonly used. The thing that takes relatively longer to do is I/O operations, and those will now return error.Canceled when requested.
Polling cancelRequested is generally a bad idea since it introduces overhead, but you could do it to introduce cancellation points into long-running CPU tasks.