| ... | @@ -251,7 +251,11 @@ const Closure = struct { | ... | @@ -251,7 +251,11 @@ const Closure = struct { |
| 251 | .sec = 0, | 251 | .sec = 0, |
| 252 | .nsec = @as(isize, 1) << @intCast(attempt_index), | 252 | .nsec = @as(isize, 1) << @intCast(attempt_index), |
| 253 | }; | 253 | }; |
| 254 | _ = posix.system.nanosleep(&timespec, &timespec); | 254 | if (native_os == .linux) { |
| | 255 | _ = std.os.linux.clock_nanosleep(posix.CLOCK.MONOTONIC, .{ .ABSTIME = false }, &timespec, &timespec); |
| | 256 | } else { |
| | 257 | _ = posix.system.nanosleep(&timespec, &timespec); |
| | 258 | } |
| 255 | | 259 | |
| 256 | switch (@atomicRmw(CancelStatus, &closure.cancel_status, .Xchg, .requested, .monotonic).unpack()) { | 260 | switch (@atomicRmw(CancelStatus, &closure.cancel_status, .Xchg, .requested, .monotonic).unpack()) { |
| 257 | .requested => continue, // Retry needed in case other thread hasn't yet entered the syscall. | 261 | .requested => continue, // Retry needed in case other thread hasn't yet entered the syscall. |