fix aliasing issue in unix sleep function

This commit is contained in:
Ralf Jung 2020-10-31 16:16:54 +01:00
parent ed96321e7e
commit 9f630af930

View File

@ -178,7 +178,8 @@ impl Thread {
tv_nsec: nsecs,
};
secs -= ts.tv_sec as u64;
if libc::nanosleep(&ts, &mut ts) == -1 {
let ts_ptr = &mut ts as *mut _;
if libc::nanosleep(ts_ptr, ts_ptr) == -1 {
assert_eq!(os::errno(), libc::EINTR);
secs += ts.tv_sec as u64;
nsecs = ts.tv_nsec;