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 › Uring › batchCancel Private Function batchCancel Doc Source Private Function std.Io.Uring.batchCancel
fn batchCancel (userdata : ?*anyopaque , batch : *Io .Batch ) void Params userdata : ?*anyopaque batch : *Io .Batch File Io/Uring.zig: 2544
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580 fn batchCancel (userdata : ?*anyopaque , batch : *Io .Batch ) void {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
_ = ev ;
batchDrainReady (batch ) catch |err | switch (err ) {
error .Timeout => unreachable , // no timeout
};
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 , // blocked
};
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 , // no timeout
};
}