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 › fileUnlock Private Function fileUnlock Doc Source Private Function std.Io.Dispatch.fileUnlock
fn fileUnlock (userdata : ?*anyopaque , file : File ) void Params userdata : ?*anyopaque file : File File Io/Dispatch.zig: 3748
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761 fn fileUnlock (userdata : ?*anyopaque , file : File ) void {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
_ = ev ;
while (true ) switch (c .errno (c .flock (file .handle , c .LOCK .UN ))) {
.SUCCESS => return ,
.INTR => {},
.AGAIN => return recoverableOsBugDetected (), // unlocking can't block
.BADF => return recoverableOsBugDetected (), // File descriptor used after closed.
.INVAL => return recoverableOsBugDetected (), // invalid parameters
.NOLCK => return recoverableOsBugDetected (), // Resource deallocation.
.OPNOTSUPP => return recoverableOsBugDetected (), // We already got the lock.
else => return recoverableOsBugDetected (), // Resource deallocation must succeed.
};
}