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/ › Uring.zig › batchCancel
batchCancel
Uring.batchCancel
fn batchCancel (userdata : ?*anyopaque , batch : *Io .Batch ) void
File
Code
fn batchCancel (userdata : ?*anyopaque , batch : *Io .Batch ) void {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
_ = ev ;
batchDrainReady (batch ) catch |err | switch (err ) {
error .Timeout => unreachable ,
};
var index = batch .pending .head ;
if (index == .none ) return ;
var cancel_region : CancelRegion = .initBlocked ();
defer cancel_region .deinit ();
const thread = cancel_region .awaitIoUring () catch |err | switch (err ) {
error .Canceled => unreachable ,
};
while (index != .none ) {
const pending = &batch .storage [index .toIndex ()].pending ;
thread .enqueue ().* = .{
.opcode = .ASYNC_CANCEL ,
.flags = linux .IOSQE_CQE_SKIP_SUCCESS ,
.ioprio = 0 ,
.fd = 0 ,
.off = 0 ,
.addr = @intFromPtr (&pending .userdata ) | 0b10 ,
.len = 0 ,
.rw_flags = 0 ,
.user_data = @backingInt (Completion .Userdata .wakeup ),
.buf_index = 0 ,
.personality = 0 ,
.splice_fd_in = 0 ,
.addr3 = 0 ,
.resv = 0 ,
};
index = pending .node .next ;
}
while (batch .pending .head != .none ) batchDrainReady (batch ) catch |err | switch (err ) {
error .Timeout => unreachable ,
};
}