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 standard library.
std › Io › Dispatch › Cancelable › enter Private Function enter Doc Source Private Function std.Io.Dispatch.Cancelable.enter
fn enter (cancelable : *Cancelable , fiber : *Fiber ) RequestedError !void Params File Io/Dispatch.zig: 728
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747 fn enter (cancelable : *Cancelable , fiber : *Fiber ) RequestedError !void {
const function = cancelable .cancel ;
assert (function != is_requested );
if (function == is_blocked ) {
@branchHint (.unlikely );
return ;
}
if (@cmpxchgStrong (
Fiber .CancelStatus ,
&fiber .cancel_status ,
.{ .requested = false , .awaiting = .nothing },
.{ .requested = false , .awaiting = .fromCancelable (cancelable ) },
.release ,
.monotonic ,
)) |cancel_status | {
assert (cancel_status .requested and cancel_status .awaiting == .nothing );
cancelable .cancel = is_requested ;
return error .CancelRequested ;
}
}