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 › Threaded › Syscall › toAlertable Private Function toAlertable Doc Source Private Function std.Io.Threaded.Syscall.toAlertable
fn toAlertable (s : Syscall ) Io .Cancelable !AlertableSyscall Params File Io/Threaded.zig: 1410
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432 fn toAlertable (s : Syscall ) Io .Cancelable !AlertableSyscall {
comptime assert (is_windows );
const thread = s .thread orelse return .{ .thread = null };
var prev = thread .status .load (.monotonic );
while (true ) prev = switch (prev .cancelation ) {
.none => unreachable ,
.parked => unreachable ,
.blocked_alertable => unreachable ,
.blocked_alertable_canceling => unreachable ,
.canceling => unreachable ,
.canceled => unreachable ,
.blocked => thread .status .cmpxchgWeak (prev , .{
.cancelation = .blocked_alertable ,
.awaitable = prev .awaitable ,
}, .monotonic , .monotonic ) orelse return .{ .thread = thread },
.blocked_canceling => thread .status .cmpxchgWeak (prev , .{
.cancelation = .canceled ,
.awaitable = prev .awaitable ,
}, .monotonic , .monotonic ) orelse return error .Canceled ,
};
}
Indicates instead of
NtCancelSynchronousIoFilewe need to useNtAlertThreadto interrupt the wait.Windows only, called from blocked state only.