4 ms·
So a cancelable function must poll the `cancelRequested` function, and return the error `Canceled`, right? https://github.com/ziglang/zig/blob/master/lib/std/I
by geon 11mo ago
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#L1611 https://github.com/ziglang/zig/blob/master/lib/std/Io.zig#L1...
https://github.com/ziglang/zig/blob/master/lib/std/Io.zig#L713 https://github.com/ziglang/zig/blob/master/lib/std/Io.zig#L7...
- AndyKelley 11mo agoIn 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.