| ... | @@ -10083,10 +10083,12 @@ fn sleepPosix(timeout: Io.Timeout) Io.SleepError!void { | ... | @@ -10083,10 +10083,12 @@ fn sleepPosix(timeout: Io.Timeout) Io.SleepError!void { |
| 10083 | var timespec: posix.timespec = timestampToPosix(deadline_nanoseconds); | 10083 | var timespec: posix.timespec = timestampToPosix(deadline_nanoseconds); |
| 10084 | const syscall: Syscall = try .start(); | 10084 | const syscall: Syscall = try .start(); |
| 10085 | while (true) { | 10085 | while (true) { |
| 10086 | switch (posix.errno(posix.system.clock_nanosleep(clock_id, .{ .ABSTIME = switch (timeout) { | 10086 | const rc = posix.system.clock_nanosleep(clock_id, .{ .ABSTIME = switch (timeout) { |
| 10087 | .none, .duration => false, | 10087 | .none, .duration => false, |
| 10088 | .deadline => true, | 10088 | .deadline => true, |
| 10089 | } }, &timespec, &timespec))) { | 10089 | } }, &timespec, &timespec); |
| | 10090 | // POSIX-standard libc clock_nanosleep() returns *positive* errno values directly |
| | 10091 | switch (if (builtin.link_libc) @as(posix.E, @enumFromInt(rc)) else posix.errno(rc)) { |
| 10090 | .SUCCESS => { | 10092 | .SUCCESS => { |
| 10091 | syscall.finish(); | 10093 | syscall.finish(); |
| 10092 | return; | 10094 | return; |