Skip to content

Commit bf3be09

Browse files
committed
Fix timeout conversion
1 parent 9515760 commit bf3be09

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

library/std/src/sys/unix/futex.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,13 @@ pub fn futex_wait(futex: &AtomicI32, expected: i32, timeout: Option<Duration>) {
4242
) -> libc::c_int;
4343
}
4444

45-
let timeout_ms = timeout.map(|d| d.as_millis());
4645
unsafe {
4746
emscripten_futex_wait(
4847
futex as *const AtomicI32,
4948
// `val` is declared unsigned to match the Emscripten headers, but since it's used as
5049
// an opaque value, we can ignore the meaning of signed vs. unsigned and cast here.
5150
expected as libc::c_uint,
52-
timeout_ms.map_or(crate::f64::INFINITY, |d| d as libc::c_double),
51+
timeout.map_or(crate::f64::INFINITY, |d| d.as_secs_f64() * 1000.0),
5352
);
5453
}
5554
}

0 commit comments

Comments
 (0)