diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
commit | 4f9fe856a25ab29345b90e7725509e9ee38a37be (patch) | |
tree | e4ffd8a9374cae7b21f7cbfb352927e0e074aff6 /vendor/parking_lot_core/src/thread_parker | |
parent | Adding upstream version 1.68.2+dfsg1. (diff) | |
download | rustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.tar.xz rustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.zip |
Adding upstream version 1.69.0+dfsg1.upstream/1.69.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | vendor/parking_lot_core/src/thread_parker/linux.rs | 8 | ||||
-rw-r--r-- | vendor/parking_lot_core/src/thread_parker/unix.rs | 8 |
2 files changed, 9 insertions, 7 deletions
diff --git a/vendor/parking_lot_core/src/thread_parker/linux.rs b/vendor/parking_lot_core/src/thread_parker/linux.rs index 5d4e229ad..92601f62a 100644 --- a/vendor/parking_lot_core/src/thread_parker/linux.rs +++ b/vendor/parking_lot_core/src/thread_parker/linux.rs @@ -80,10 +80,10 @@ impl super::ThreadParkerT for ThreadParker { self.park(); return true; } - let ts = libc::timespec { - tv_sec: diff.as_secs() as libc::time_t, - tv_nsec: diff.subsec_nanos() as tv_nsec_t, - }; + // SAFETY: libc::timespec is zero initializable. + let mut ts: libc::timespec = std::mem::zeroed(); + ts.tv_sec = diff.as_secs() as libc::time_t; + ts.tv_nsec = diff.subsec_nanos() as tv_nsec_t; self.futex_wait(Some(ts)); } true diff --git a/vendor/parking_lot_core/src/thread_parker/unix.rs b/vendor/parking_lot_core/src/thread_parker/unix.rs index 88b6df839..7f2860372 100644 --- a/vendor/parking_lot_core/src/thread_parker/unix.rs +++ b/vendor/parking_lot_core/src/thread_parker/unix.rs @@ -5,7 +5,7 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] use core::ptr; use core::{ cell::{Cell, UnsafeCell}, @@ -130,6 +130,7 @@ impl ThreadParker { #[cfg(any( target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "android", target_os = "espidf" ))] @@ -140,6 +141,7 @@ impl ThreadParker { #[cfg(not(any( target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "android", target_os = "espidf" )))] @@ -193,7 +195,7 @@ impl super::UnparkHandleT for UnparkHandle { } // Returns the current time on the clock used by pthread_cond_t as a timespec. -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] #[inline] fn timespec_now() -> libc::timespec { let mut now = MaybeUninit::<libc::timeval>::uninit(); @@ -206,7 +208,7 @@ fn timespec_now() -> libc::timespec { tv_nsec: now.tv_usec as tv_nsec_t * 1000, } } -#[cfg(not(any(target_os = "macos", target_os = "ios")))] +#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "watchos")))] #[inline] fn timespec_now() -> libc::timespec { let mut now = MaybeUninit::<libc::timespec>::uninit(); |