Skip to content

Commit c688def

Browse files
committed
pal/hermit: saturate usleep microseconds at u64::MAX
Signed-off-by: Martin Kröning <[email protected]>
1 parent fdb5fc1 commit c688def

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: std/src/sys/pal/hermit/thread.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ impl Thread {
7878
#[inline]
7979
pub fn sleep(dur: Duration) {
8080
let micros = dur.as_micros() + if dur.subsec_nanos() % 1_000 > 0 { 1 } else { 0 };
81+
let micros = u64::try_from(micros).unwrap_or(u64::MAX);
8182

8283
unsafe {
83-
hermit_abi::usleep(micros as u64);
84+
hermit_abi::usleep(micros);
8485
}
8586
}
8687

0 commit comments

Comments
 (0)