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.
fnchildKillWindows(t: *Threaded, child: *process.Child, exit_code: windows.UINT) !void {
_ = t; // TODO cancelationconsthandle = child.id.?;
_ = windows.ntdll.RtlReportSilentProcessExit(handle, @fromBackingInt(@intCast(exit_code)));
switch (windows.ntdll.NtTerminateProcess(handle, @fromBackingInt(@intCast(exit_code)))) {
.SUCCESS, .PROCESS_IS_TERMINATING => {
constinfinite_timeout: windows.LARGE_INTEGER = std.math.minInt(windows.LARGE_INTEGER);
_ = windows.ntdll.NtWaitForSingleObject(handle, .FALSE, &infinite_timeout);
childCleanupWindows(child);
},
.ACCESS_DENIED => {
// Usually when TerminateProcess triggers a ACCESS_DENIED error, it
// indicates that the process has already exited, but there may be
// some rare edge cases where our process handle no longer has the
// PROCESS_TERMINATE access right, so let's do another check to make
// sure the process is really no longer running:
constminimal_timeout: windows.LARGE_INTEGER = -1;
returnswitch (windows.ntdll.NtWaitForSingleObject(handle, .FALSE, &minimal_timeout)) {
windows.NTSTATUS.WAIT_0 => error.AlreadyTerminated,
else => error.AccessDenied,
};
},
else => |status| returnwindows.unexpectedStatus(status),
}
}