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 › fileDowngradeLock Private Function fileDowngradeLock Doc Source Private Function std.Io.Dispatch.fileDowngradeLock
fn fileDowngradeLock (userdata : ?*anyopaque , file : File ) File .DowngradeLockError !void Params userdata : ?*anyopaque file : File File Io/Dispatch.zig: 3763
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777 fn fileDowngradeLock (userdata : ?*anyopaque , file : File ) File .DowngradeLockError !void {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
_ = ev ;
const operation = c .LOCK .SH | c .LOCK .NB ;
while (true ) switch (c .errno (c .flock (file .handle , operation ))) {
.SUCCESS => return ,
.INTR => {},
.AGAIN => |err | return errnoBug (err ), // File was not locked in exclusive mode.
.BADF => |err | return errnoBug (err ),
.INVAL => |err | return errnoBug (err ), // invalid parameters
.NOLCK => |err | return errnoBug (err ), // Lock already obtained.
.OPNOTSUPP => |err | return errnoBug (err ), // Lock already obtained.
else => |err | return unexpectedErrno (err ),
};
}