We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Thread::sleep
1 parent 1a94d83 commit 687c8a1Copy full SHA for 687c8a1
library/std/src/sys/pal/hermit/thread.rs
@@ -77,8 +77,10 @@ impl Thread {
77
78
#[inline]
79
pub fn sleep(dur: Duration) {
80
+ let micros = dur.as_micros() + if dur.subsec_nanos() % 1_000 > 0 { 1 } else { 0 };
81
+
82
unsafe {
- hermit_abi::usleep(dur.as_micros() as u64);
83
+ hermit_abi::usleep(micros as u64);
84
}
85
86
0 commit comments