authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-01 19:11:47-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-01 19:17:52-08:00
logbb3f56d5d5424c7be42132c047a7146e82b49c74
treee018d8ea82b13a0b1a73c04b4688adecc963e3a4
parentcf82064ebc3063c6a8e8f51388783ed1c01d6281

std.Io.Threaded: separate out ECANCELED handling again

If ECANCELED occurs, it's from pthread_cancel which will *permanently* set that thread to be in a "canceling" state, which means the cancel cannot be ignored. That means it cannot be retried, like EINTR. It must be acknowledged.

1 files changed, 112 insertions(+), 54 deletions(-)

lib/std/Io/Threaded.zig+112-54
......@@ -145,6 +145,13 @@ const Thread = struct {
145145 ) orelse return;
146146 }
147147
148 fn endSyscallCanceled(thread: *Thread) Io.Cancelable {
149 if (thread.current_closure) |closure| {
150 @atomicStore(CancelStatus, &closure.cancel_status, .acknowledged, .release);
151 }
152 return error.Canceled;
153 }
154
148155 fn currentSignalId() SignaleeId {
149156 return if (std.Thread.use_pthreads) std.c.pthread_self() else std.Thread.getCurrentId();
150157 }
......@@ -1211,10 +1218,11 @@ fn dirMakePosix(userdata: ?*anyopaque, dir: Io.Dir, sub_path: []const u8, mode:
12111218 current_thread.endSyscall();
12121219 return;
12131220 },
1214 .INTR, .CANCELED => {
1221 .INTR => {
12151222 try current_thread.checkCancel();
12161223 continue;
12171224 },
1225 .CANCELED => return current_thread.endSyscallCanceled(),
12181226 else => |e| {
12191227 current_thread.endSyscall();
12201228 switch (e) {
......@@ -1253,10 +1261,11 @@ fn dirMakeWasi(userdata: ?*anyopaque, dir: Io.Dir, sub_path: []const u8, mode: I
12531261 current_thread.endSyscall();
12541262 return;
12551263 },
1256 .INTR, .CANCELED => {
1264 .INTR => {
12571265 try current_thread.checkCancel();
12581266 continue;
12591267 },
1268 .CANCELED => return current_thread.endSyscallCanceled(),
12601269 else => |e| {
12611270 current_thread.endSyscall();
12621271 switch (e) {
......@@ -1518,10 +1527,11 @@ fn dirStatPathLinux(
15181527 current_thread.endSyscall();
15191528 return statFromLinux(&statx);
15201529 },
1521 .INTR, .CANCELED => {
1530 .INTR => {
15221531 try current_thread.checkCancel();
15231532 continue;
15241533 },
1534 .CANCELED => return current_thread.endSyscallCanceled(),
15251535 else => |e| {
15261536 current_thread.endSyscall();
15271537 switch (e) {
......@@ -1563,10 +1573,11 @@ fn dirStatPathPosix(
15631573 current_thread.endSyscall();
15641574 return statFromPosix(&stat);
15651575 },
1566 .INTR, .CANCELED => {
1576 .INTR => {
15671577 try current_thread.checkCancel();
15681578 continue;
15691579 },
1580 .CANCELED => return current_thread.endSyscallCanceled(),
15701581 else => |e| {
15711582 current_thread.endSyscall();
15721583 switch (e) {
......@@ -1623,10 +1634,11 @@ fn dirStatPathWasi(
16231634 current_thread.endSyscall();
16241635 return statFromWasi(&stat);
16251636 },
1626 .INTR, .CANCELED => {
1637 .INTR => {
16271638 try current_thread.checkCancel();
16281639 continue;
16291640 },
1641 .CANCELED => return current_thread.endSyscallCanceled(),
16301642 else => |e| {
16311643 current_thread.endSyscall();
16321644 switch (e) {
......@@ -1668,10 +1680,11 @@ fn fileStatPosix(userdata: ?*anyopaque, file: Io.File) Io.File.StatError!Io.File
16681680 current_thread.endSyscall();
16691681 return statFromPosix(&stat);
16701682 },
1671 .INTR, .CANCELED => {
1683 .INTR => {
16721684 try current_thread.checkCancel();
16731685 continue;
16741686 },
1687 .CANCELED => return current_thread.endSyscallCanceled(),
16751688 else => |e| {
16761689 current_thread.endSyscall();
16771690 switch (e) {
......@@ -1706,10 +1719,11 @@ fn fileStatLinux(userdata: ?*anyopaque, file: Io.File) Io.File.StatError!Io.File
17061719 current_thread.endSyscall();
17071720 return statFromLinux(&statx);
17081721 },
1709 .INTR, .CANCELED => {
1722 .INTR => {
17101723 try current_thread.checkCancel();
17111724 continue;
17121725 },
1726 .CANCELED => return current_thread.endSyscallCanceled(),
17131727 else => |e| {
17141728 current_thread.endSyscall();
17151729 switch (e) {
......@@ -1791,10 +1805,11 @@ fn fileStatWasi(userdata: ?*anyopaque, file: Io.File) Io.File.StatError!Io.File.
17911805 current_thread.endSyscall();
17921806 return statFromWasi(&stat);
17931807 },
1794 .INTR, .CANCELED => {
1808 .INTR => {
17951809 try current_thread.checkCancel();
17961810 continue;
17971811 },
1812 .CANCELED => return current_thread.endSyscallCanceled(),
17981813 else => |e| {
17991814 current_thread.endSyscall();
18001815 switch (e) {
......@@ -1842,10 +1857,11 @@ fn dirAccessPosix(
18421857 current_thread.endSyscall();
18431858 return;
18441859 },
1845 .INTR, .CANCELED => {
1860 .INTR => {
18461861 try current_thread.checkCancel();
18471862 continue;
18481863 },
1864 .CANCELED => return current_thread.endSyscallCanceled(),
18491865 else => |e| {
18501866 current_thread.endSyscall();
18511867 switch (e) {
......@@ -1891,10 +1907,11 @@ fn dirAccessWasi(
18911907 current_thread.endSyscall();
18921908 break;
18931909 },
1894 .INTR, .CANCELED => {
1910 .INTR => {
18951911 try current_thread.checkCancel();
18961912 continue;
18971913 },
1914 .CANCELED => return current_thread.endSyscallCanceled(),
18981915 else => |e| {
18991916 current_thread.endSyscall();
19001917 switch (e) {
......@@ -2037,10 +2054,11 @@ fn dirCreateFilePosix(
20372054 current_thread.endSyscall();
20382055 break @intCast(rc);
20392056 },
2040 .INTR, .CANCELED => {
2057 .INTR => {
20412058 try current_thread.checkCancel();
20422059 continue;
20432060 },
2061 .CANCELED => return current_thread.endSyscallCanceled(),
20442062 else => |e| {
20452063 current_thread.endSyscall();
20462064 switch (e) {
......@@ -2091,10 +2109,11 @@ fn dirCreateFilePosix(
20912109 current_thread.endSyscall();
20922110 break;
20932111 },
2094 .INTR, .CANCELED => {
2112 .INTR => {
20952113 try current_thread.checkCancel();
20962114 continue;
20972115 },
2116 .CANCELED => return current_thread.endSyscallCanceled(),
20982117 else => |e| {
20992118 current_thread.endSyscall();
21002119 switch (e) {
......@@ -2119,7 +2138,7 @@ fn dirCreateFilePosix(
21192138 current_thread.endSyscall();
21202139 break @intCast(rc);
21212140 },
2122 .INTR, .CANCELED => {
2141 .INTR => {
21232142 try current_thread.checkCancel();
21242143 continue;
21252144 },
......@@ -2139,7 +2158,7 @@ fn dirCreateFilePosix(
21392158 current_thread.endSyscall();
21402159 break;
21412160 },
2142 .INTR, .CANCELED => {
2161 .INTR => {
21432162 try current_thread.checkCancel();
21442163 continue;
21452164 },
......@@ -2245,10 +2264,11 @@ fn dirCreateFileWasi(
22452264 current_thread.endSyscall();
22462265 return .{ .handle = fd };
22472266 },
2248 .INTR, .CANCELED => {
2267 .INTR => {
22492268 try current_thread.checkCancel();
22502269 continue;
22512270 },
2271 .CANCELED => return current_thread.endSyscallCanceled(),
22522272 else => |e| {
22532273 current_thread.endSyscall();
22542274 switch (e) {
......@@ -2338,10 +2358,11 @@ fn dirOpenFilePosix(
23382358 current_thread.endSyscall();
23392359 break @intCast(rc);
23402360 },
2341 .INTR, .CANCELED => {
2361 .INTR => {
23422362 try current_thread.checkCancel();
23432363 continue;
23442364 },
2365 .CANCELED => return current_thread.endSyscallCanceled(),
23452366 else => |e| {
23462367 current_thread.endSyscall();
23472368 switch (e) {
......@@ -2391,10 +2412,11 @@ fn dirOpenFilePosix(
23912412 current_thread.endSyscall();
23922413 break;
23932414 },
2394 .INTR, .CANCELED => {
2415 .INTR => {
23952416 try current_thread.checkCancel();
23962417 continue;
23972418 },
2419 .CANCELED => return current_thread.endSyscallCanceled(),
23982420 else => |e| {
23992421 current_thread.endSyscall();
24002422 switch (e) {
......@@ -2419,10 +2441,11 @@ fn dirOpenFilePosix(
24192441 current_thread.endSyscall();
24202442 break @intCast(rc);
24212443 },
2422 .INTR, .CANCELED => {
2444 .INTR => {
24232445 try current_thread.checkCancel();
24242446 continue;
24252447 },
2448 .CANCELED => return current_thread.endSyscallCanceled(),
24262449 else => |err| {
24272450 current_thread.endSyscall();
24282451 return posix.unexpectedErrno(err);
......@@ -2439,10 +2462,11 @@ fn dirOpenFilePosix(
24392462 current_thread.endSyscall();
24402463 break;
24412464 },
2442 .INTR, .CANCELED => {
2465 .INTR => {
24432466 try current_thread.checkCancel();
24442467 continue;
24452468 },
2469 .CANCELED => return current_thread.endSyscallCanceled(),
24462470 else => |err| {
24472471 current_thread.endSyscall();
24482472 return posix.unexpectedErrno(err);
......@@ -2637,10 +2661,11 @@ fn dirOpenFileWasi(
26372661 current_thread.endSyscall();
26382662 return .{ .handle = fd };
26392663 },
2640 .INTR, .CANCELED => {
2664 .INTR => {
26412665 try current_thread.checkCancel();
26422666 continue;
26432667 },
2668 .CANCELED => return current_thread.endSyscallCanceled(),
26442669 else => |e| {
26452670 current_thread.endSyscall();
26462671 switch (e) {
......@@ -2720,10 +2745,11 @@ fn dirOpenDirPosix(
27202745 current_thread.endSyscall();
27212746 return .{ .handle = @intCast(rc) };
27222747 },
2723 .INTR, .CANCELED => {
2748 .INTR => {
27242749 try current_thread.checkCancel();
27252750 continue;
27262751 },
2752 .CANCELED => return current_thread.endSyscallCanceled(),
27272753 else => |e| {
27282754 current_thread.endSyscall();
27292755 switch (e) {
......@@ -2772,10 +2798,11 @@ fn dirOpenDirHaiku(
27722798 return .{ .handle = rc };
27732799 }
27742800 switch (@as(posix.E, @enumFromInt(rc))) {
2775 .INTR, .CANCELED => {
2801 .INTR => {
27762802 try current_thread.checkCancel();
27772803 continue;
27782804 },
2805 .CANCELED => return current_thread.endSyscallCanceled(),
27792806 else => |e| {
27802807 current_thread.endSyscall();
27812808 switch (e) {
......@@ -2916,10 +2943,11 @@ fn dirOpenDirWasi(
29162943 current_thread.endSyscall();
29172944 return .{ .handle = fd };
29182945 },
2919 .INTR, .CANCELED => {
2946 .INTR => {
29202947 try current_thread.checkCancel();
29212948 continue;
29222949 },
2950 .CANCELED => return current_thread.endSyscallCanceled(),
29232951 else => |e| {
29242952 current_thread.endSyscall();
29252953 switch (e) {
......@@ -2982,10 +3010,11 @@ fn fileReadStreamingPosix(userdata: ?*anyopaque, file: Io.File, data: [][]u8) Io
29823010 current_thread.endSyscall();
29833011 return nread;
29843012 },
2985 .INTR, .CANCELED => {
3013 .INTR => {
29863014 try current_thread.checkCancel();
29873015 continue;
29883016 },
3017 .CANCELED => return current_thread.endSyscallCanceled(),
29893018 else => |e| {
29903019 current_thread.endSyscall();
29913020 switch (e) {
......@@ -3015,10 +3044,11 @@ fn fileReadStreamingPosix(userdata: ?*anyopaque, file: Io.File, data: [][]u8) Io
30153044 current_thread.endSyscall();
30163045 return @intCast(rc);
30173046 },
3018 .INTR, .CANCELED => {
3047 .INTR => {
30193048 try current_thread.checkCancel();
30203049 continue;
30213050 },
3051 .CANCELED => return current_thread.endSyscallCanceled(),
30223052 else => |e| {
30233053 current_thread.endSyscall();
30243054 switch (e) {
......@@ -3100,10 +3130,11 @@ fn fileReadPositionalPosix(userdata: ?*anyopaque, file: Io.File, data: [][]u8, o
31003130 current_thread.endSyscall();
31013131 return nread;
31023132 },
3103 .INTR, .CANCELED => {
3133 .INTR => {
31043134 try current_thread.checkCancel();
31053135 continue;
31063136 },
3137 .CANCELED => return current_thread.endSyscallCanceled(),
31073138 else => |e| {
31083139 current_thread.endSyscall();
31093140 switch (e) {
......@@ -3137,10 +3168,11 @@ fn fileReadPositionalPosix(userdata: ?*anyopaque, file: Io.File, data: [][]u8, o
31373168 current_thread.endSyscall();
31383169 return @bitCast(rc);
31393170 },
3140 .INTR, .CANCELED => {
3171 .INTR => {
31413172 try current_thread.checkCancel();
31423173 continue;
31433174 },
3175 .CANCELED => return current_thread.endSyscallCanceled(),
31443176 else => |e| {
31453177 current_thread.endSyscall();
31463178 switch (e) {
......@@ -3238,10 +3270,11 @@ fn fileSeekTo(userdata: ?*anyopaque, file: Io.File, offset: u64) Io.File.SeekErr
32383270 current_thread.endSyscall();
32393271 return;
32403272 },
3241 .INTR, .CANCELED => {
3273 .INTR => {
32423274 try current_thread.checkCancel();
32433275 continue;
32443276 },
3277 .CANCELED => return current_thread.endSyscallCanceled(),
32453278 else => |e| {
32463279 current_thread.endSyscall();
32473280 switch (e) {
......@@ -3270,10 +3303,11 @@ fn fileSeekTo(userdata: ?*anyopaque, file: Io.File, offset: u64) Io.File.SeekErr
32703303 current_thread.endSyscall();
32713304 return;
32723305 },
3273 .INTR, .CANCELED => {
3306 .INTR => {
32743307 try current_thread.checkCancel();
32753308 continue;
32763309 },
3310 .CANCELED => return current_thread.endSyscallCanceled(),
32773311 else => |e| {
32783312 current_thread.endSyscall();
32793313 switch (e) {
......@@ -3298,10 +3332,11 @@ fn fileSeekTo(userdata: ?*anyopaque, file: Io.File, offset: u64) Io.File.SeekErr
32983332 current_thread.endSyscall();
32993333 return;
33003334 },
3301 .INTR, .CANCELED => {
3335 .INTR => {
33023336 try current_thread.checkCancel();
33033337 continue;
33043338 },
3339 .CANCELED => return current_thread.endSyscallCanceled(),
33053340 else => |e| {
33063341 current_thread.endSyscall();
33073342 switch (e) {
......@@ -3453,10 +3488,11 @@ fn sleepLinux(userdata: ?*anyopaque, timeout: Io.Timeout) Io.SleepError!void {
34533488 current_thread.endSyscall();
34543489 return;
34553490 },
3456 .INTR, .CANCELED => {
3491 .INTR => {
34573492 try current_thread.checkCancel();
34583493 continue;
34593494 },
3495 .CANCELED => return current_thread.endSyscallCanceled(),
34603496 else => |e| {
34613497 current_thread.endSyscall();
34623498 switch (e) {
......@@ -3530,10 +3566,11 @@ fn sleepPosix(userdata: ?*anyopaque, timeout: Io.Timeout) Io.SleepError!void {
35303566 try current_thread.beginSyscall();
35313567 while (true) {
35323568 switch (posix.errno(posix.system.nanosleep(&timespec, &timespec))) {
3533 .INTR, .CANCELED => {
3569 .INTR => {
35343570 try current_thread.checkCancel();
35353571 continue;
35363572 },
3573 .CANCELED => return current_thread.endSyscallCanceled(),
35373574 // This prong handles success as well as unexpected errors.
35383575 else => return current_thread.endSyscall(),
35393576 }
......@@ -3603,10 +3640,11 @@ fn netListenIpPosix(
36033640 current_thread.endSyscall();
36043641 break;
36053642 },
3606 .INTR, .CANCELED => {
3643 .INTR => {
36073644 try current_thread.checkCancel();
36083645 continue;
36093646 },
3647 .CANCELED => return current_thread.endSyscallCanceled(),
36103648 else => |e| {
36113649 current_thread.endSyscall();
36123650 switch (e) {
......@@ -3766,10 +3804,11 @@ fn netListenUnixPosix(
37663804 current_thread.endSyscall();
37673805 break;
37683806 },
3769 .INTR, .CANCELED => {
3807 .INTR => {
37703808 try current_thread.checkCancel();
37713809 continue;
37723810 },
3811 .CANCELED => return current_thread.endSyscallCanceled(),
37733812 else => |e| {
37743813 current_thread.endSyscall();
37753814 switch (e) {
......@@ -3889,10 +3928,11 @@ fn posixBindUnix(
38893928 current_thread.endSyscall();
38903929 break;
38913930 },
3892 .INTR, .CANCELED => {
3931 .INTR => {
38933932 try current_thread.checkCancel();
38943933 continue;
38953934 },
3935 .CANCELED => return current_thread.endSyscallCanceled(),
38963936 else => |e| {
38973937 current_thread.endSyscall();
38983938 switch (e) {
......@@ -3933,10 +3973,11 @@ fn posixBind(
39333973 current_thread.endSyscall();
39343974 break;
39353975 },
3936 .INTR, .CANCELED => {
3976 .INTR => {
39373977 try current_thread.checkCancel();
39383978 continue;
39393979 },
3980 .CANCELED => return current_thread.endSyscallCanceled(),
39403981 else => |e| {
39413982 current_thread.endSyscall();
39423983 switch (e) {
......@@ -3968,10 +4009,11 @@ fn posixConnect(
39684009 current_thread.endSyscall();
39694010 return;
39704011 },
3971 .INTR, .CANCELED => {
4012 .INTR => {
39724013 try current_thread.checkCancel();
39734014 continue;
39744015 },
4016 .CANCELED => return current_thread.endSyscallCanceled(),
39754017 else => |e| {
39764018 current_thread.endSyscall();
39774019 switch (e) {
......@@ -4014,10 +4056,11 @@ fn posixConnectUnix(
40144056 current_thread.endSyscall();
40154057 return;
40164058 },
4017 .INTR, .CANCELED => {
4059 .INTR => {
40184060 try current_thread.checkCancel();
40194061 continue;
40204062 },
4063 .CANCELED => return current_thread.endSyscallCanceled(),
40214064 else => |e| {
40224065 current_thread.endSyscall();
40234066 switch (e) {
......@@ -4058,10 +4101,11 @@ fn posixGetSockName(
40584101 current_thread.endSyscall();
40594102 break;
40604103 },
4061 .INTR, .CANCELED => {
4104 .INTR => {
40624105 try current_thread.checkCancel();
40634106 continue;
40644107 },
4108 .CANCELED => return current_thread.endSyscallCanceled(),
40654109 else => |e| {
40664110 current_thread.endSyscall();
40674111 switch (e) {
......@@ -4125,10 +4169,11 @@ fn setSocketOption(current_thread: *Thread, fd: posix.fd_t, level: i32, opt_name
41254169 current_thread.endSyscall();
41264170 return;
41274171 },
4128 .INTR, .CANCELED => {
4172 .INTR => {
41294173 try current_thread.checkCancel();
41304174 continue;
41314175 },
4176 .CANCELED => return current_thread.endSyscallCanceled(),
41324177 else => |e| {
41334178 current_thread.endSyscall();
41344179 switch (e) {
......@@ -4457,7 +4502,8 @@ fn openSocketPosix(
44574502 try current_thread.checkCancel();
44584503 switch (posix.errno(posix.system.fcntl(fd, posix.F.SETFD, @as(usize, posix.FD_CLOEXEC)))) {
44594504 .SUCCESS => break,
4460 .INTR, .CANCELED => continue,
4505 .INTR => continue,
4506 .CANCELED => return current_thread.endSyscallCanceled(),
44614507 else => |err| {
44624508 current_thread.endSyscall();
44634509 return posix.unexpectedErrno(err);
......@@ -4467,10 +4513,11 @@ fn openSocketPosix(
44674513 current_thread.endSyscall();
44684514 break fd;
44694515 },
4470 .INTR, .CANCELED => {
4516 .INTR => {
44714517 try current_thread.checkCancel();
44724518 continue;
44734519 },
4520 .CANCELED => return current_thread.endSyscallCanceled(),
44744521 else => |e| {
44754522 current_thread.endSyscall();
44764523 switch (e) {
......@@ -4558,7 +4605,7 @@ fn netAcceptPosix(userdata: ?*anyopaque, listen_fd: net.Socket.Handle) net.Serve
45584605 try current_thread.checkCancel();
45594606 switch (posix.errno(posix.system.fcntl(fd, posix.F.SETFD, @as(usize, posix.FD_CLOEXEC)))) {
45604607 .SUCCESS => break,
4561 .INTR, .CANCELED => continue,
4608 .INTR => continue,
45624609 else => |err| {
45634610 current_thread.endSyscall();
45644611 return posix.unexpectedErrno(err);
......@@ -4568,10 +4615,11 @@ fn netAcceptPosix(userdata: ?*anyopaque, listen_fd: net.Socket.Handle) net.Serve
45684615 current_thread.endSyscall();
45694616 break fd;
45704617 },
4571 .INTR, .CANCELED => {
4618 .INTR => {
45724619 try current_thread.checkCancel();
45734620 continue;
45744621 },
4622 .CANCELED => return current_thread.endSyscallCanceled(),
45754623 else => |e| {
45764624 current_thread.endSyscall();
45774625 switch (e) {
......@@ -4676,10 +4724,11 @@ fn netReadPosix(userdata: ?*anyopaque, fd: net.Socket.Handle, data: [][]u8) net.
46764724 current_thread.endSyscall();
46774725 return n;
46784726 },
4679 .INTR, .CANCELED => {
4727 .INTR => {
46804728 try current_thread.checkCancel();
46814729 continue;
46824730 },
4731 .CANCELED => return current_thread.endSyscallCanceled(),
46834732 else => |e| {
46844733 current_thread.endSyscall();
46854734 switch (e) {
......@@ -4708,10 +4757,11 @@ fn netReadPosix(userdata: ?*anyopaque, fd: net.Socket.Handle, data: [][]u8) net.
47084757 current_thread.endSyscall();
47094758 return @intCast(rc);
47104759 },
4711 .INTR, .CANCELED => {
4760 .INTR => {
47124761 try current_thread.checkCancel();
47134762 continue;
47144763 },
4764 .CANCELED => return current_thread.endSyscallCanceled(),
47154765 else => |e| {
47164766 current_thread.endSyscall();
47174767 switch (e) {
......@@ -4943,10 +4993,11 @@ fn netSendOne(
49434993 message.data_len = @intCast(rc);
49444994 return;
49454995 },
4946 .INTR, .CANCELED => {
4996 .INTR => {
49474997 try current_thread.checkCancel();
49484998 continue;
49494999 },
5000 .CANCELED => return current_thread.endSyscallCanceled(),
49505001 else => |e| {
49515002 current_thread.endSyscall();
49525003 switch (e) {
......@@ -5019,10 +5070,11 @@ fn netSendMany(
50195070 }
50205071 return n;
50215072 },
5022 .INTR, .CANCELED => {
5073 .INTR => {
50235074 try current_thread.checkCancel();
50245075 continue;
50255076 },
5077 .CANCELED => return current_thread.endSyscallCanceled(),
50265078 else => |e| {
50275079 current_thread.endSyscall();
50285080 switch (e) {
......@@ -5154,7 +5206,8 @@ fn netReceivePosix(
51545206 }
51555207 continue :recv;
51565208 },
5157 .INTR, .CANCELED => continue,
5209 .INTR => continue,
5210 .CANCELED => return .{ current_thread.endSyscallCanceled(), message_i },
51585211
51595212 .FAULT => |err| return .{ errnoBug(err), message_i },
51605213 .INVAL => |err| return .{ errnoBug(err), message_i },
......@@ -5162,7 +5215,8 @@ fn netReceivePosix(
51625215 else => |err| return .{ posix.unexpectedErrno(err), message_i },
51635216 }
51645217 },
5165 .INTR, .CANCELED => continue,
5218 .INTR => continue,
5219 .CANCELED => return .{ current_thread.endSyscallCanceled(), message_i },
51665220
51675221 .BADF => |err| return .{ errnoBug(err), message_i },
51685222 .NFILE => return .{ error.SystemFdQuotaExceeded, message_i },
......@@ -5277,10 +5331,11 @@ fn netWritePosix(
52775331 current_thread.endSyscall();
52785332 return @intCast(rc);
52795333 },
5280 .INTR, .CANCELED => {
5334 .INTR => {
52815335 try current_thread.checkCancel();
52825336 continue;
52835337 },
5338 .CANCELED => return current_thread.endSyscallCanceled(),
52845339 else => |e| {
52855340 current_thread.endSyscall();
52865341 switch (e) {
......@@ -5378,7 +5433,8 @@ fn netWriteWindows(
53785433 else => |err| err,
53795434 };
53805435 switch (wsa_error) {
5381 .EINTR, .ECANCELLED, .E_CANCELLED, .OPERATION_ABORTED => continue,
5436 .EINTR => continue,
5437 .ECANCELLED, .E_CANCELLED, .OPERATION_ABORTED => return current_thread.endSyscallCanceled(),
53825438 .NOTINITIALISED => {
53835439 try initializeWsa(t);
53845440 continue;
......@@ -5486,10 +5542,11 @@ fn netInterfaceNameResolve(
54865542 current_thread.endSyscall();
54875543 return .{ .index = @bitCast(ifr.ifru.ivalue) };
54885544 },
5489 .INTR, .CANCELED => {
5545 .INTR => {
54905546 try current_thread.checkCancel();
54915547 continue;
54925548 },
5549 .CANCELED => return current_thread.endSyscallCanceled(),
54935550 else => |e| {
54945551 current_thread.endSyscall();
54955552 switch (e) {
......@@ -5786,10 +5843,11 @@ fn netLookupFallible(
57865843 break;
57875844 },
57885845 .SYSTEM => switch (posix.errno(-1)) {
5789 .INTR, .CANCELED => {
5846 .INTR => {
57905847 try current_thread.checkCancel();
57915848 continue;
57925849 },
5850 .CANCELED => return current_thread.endSyscallCanceled(),
57935851 else => |e| {
57945852 current_thread.endSyscall();
57955853 return posix.unexpectedErrno(e);