Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

CancelProtection

In rare cases, it is desirable to completely block cancelation notification, so that a region of code can run uninterrupted before error.Canceled is potentially observed. Therefore, every task has a "cancel protection" state which indicates whether or not Io functions can introduce cancelation points.

To modify a task's cancel protection state, see swapCancelProtection.

For a description of cancelation and cancelation points, see Future.cancel.

Io.CancelProtection
pub const CancelProtection = enum(u1)

File

lib/std/Io.zig:1348

Code

pub const CancelProtection = enum(u1) {
    /// Any call to an `Io` function with `error.Canceled` in its error set is a cancelation point.
    ///
    /// This is the default state, which all tasks are created in.
    unblocked = 0,
    /// No `Io` function introduces a cancelation point (`error.Canceled` will never be returned).
    blocked = 1,
}