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/ › Threaded.zig › batchCancel
batchCancel
Threaded.batchCancel
fn batchCancel (userdata : ?*anyopaque , b : *Io .Batch ) void
File
Code
fn batchCancel (userdata : ?*anyopaque , b : *Io .Batch ) void {
const t : *Threaded = @ptrCast (@alignCast (userdata ));
if (is_windows ) {
if (b .pending .head == .none ) return ;
waitForApcOrAlert ();
var index = b .pending .head ;
while (index != .none ) {
const pending = &b .storage [index .toIndex ()].pending ;
const operation_userdata : *WindowsBatchOperationUserdata = .fromErased (&pending .userdata );
var cancel_iosb : windows .IO_STATUS_BLOCK = undefined ;
_ = windows .ntdll .NtCancelIoFileEx (operation_userdata .file , &operation_userdata .iosb , &cancel_iosb );
index = pending .node .next ;
}
while (b .pending .head != .none ) waitForApcOrAlert ();
} else if (b .userdata ) |batch_userdata | {
const poll_storage : [*]posix .pollfd = @ptrCast (@alignCast (batch_userdata ));
t .allocator .free (poll_storage [0 ..b .storage .len ]);
b .userdata = null ;
}
}