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.
Zig › std/ › Io/ › Dispatch.zig › fileDowngradeLock
fileDowngradeLock
Dispatch.fileDowngradeLock
fn fileDowngradeLock (userdata : ?*anyopaque , file : File ) File .DowngradeLockError !void
File
Code
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 ),
.BADF => |err | return errnoBug (err ),
.INVAL => |err | return errnoBug (err ),
.NOLCK => |err | return errnoBug (err ),
.OPNOTSUPP => |err | return errnoBug (err ),
else => |err | return unexpectedErrno (err ),
};
}