Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

checkCancel

Public Function
std.Io.checkCancel
pub fn checkCancel(io: Io) Cancelable!void

This function acts as a pure cancelation point (subject to protection; see CancelProtection) and does nothing else. In other words, it returns error.Canceled if there is an outstanding non-blocked cancelation request, but otherwise is a no-op.

It is rarely necessary to call this function. The primary use case is in long-running CPU-bound tasks which may need to respond to cancelation before completing. Short tasks, or those which perform other Io operations (and hence have other cancelation points), will typically already respond quickly to cancelation requests.

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

Params

Errors

Canceled

Caller has requested the async operation to stop.

File

Io.zig:1479
1479
1480
1481
pub fn checkCancel(io: Io) Cancelable!void {
    return io.vtable.checkCancel(io.userdata);
}