From c0a9077b87bd72ea99600ba8c230736eefdf286e Mon Sep 17 00:00:00 2001 From: Quentin Perez Date: Sat, 6 Apr 2024 15:03:32 +0200 Subject: [PATCH] Add Apple visionOS support --- core/src/thread_parker/unix.rs | 39 +++++----------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/core/src/thread_parker/unix.rs b/core/src/thread_parker/unix.rs index 329cddce..5953cf34 100644 --- a/core/src/thread_parker/unix.rs +++ b/core/src/thread_parker/unix.rs @@ -5,12 +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 = "tvos", - target_os = "ios", - target_os = "watchos" -))] +#[cfg(target_vendor = "apple")] use core::ptr; use core::{ cell::{Cell, UnsafeCell}, @@ -132,26 +127,12 @@ impl super::ThreadParkerT for ThreadParker { impl ThreadParker { /// Initializes the condvar to use CLOCK_MONOTONIC instead of CLOCK_REALTIME. - #[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", - target_os = "android", - target_os = "espidf" - ))] + #[cfg(any(target_vendor = "apple", target_os = "android", target_os = "espidf"))] #[inline] unsafe fn init(&self) {} /// Initializes the condvar to use CLOCK_MONOTONIC instead of CLOCK_REALTIME. - #[cfg(not(any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", - target_os = "android", - target_os = "espidf" - )))] + #[cfg(not(any(target_vendor = "apple", target_os = "android", target_os = "espidf")))] #[inline] unsafe fn init(&self) { let mut attr = MaybeUninit::::uninit(); @@ -202,12 +183,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", - target_os = "tvos", - target_os = "watchos" -))] +#[cfg(target_vendor = "apple")] #[inline] fn timespec_now() -> libc::timespec { let mut now = MaybeUninit::::uninit(); @@ -220,12 +196,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", - target_os = "tvos", - target_os = "watchos" -)))] +#[cfg(not(target_vendor = "apple"))] #[inline] fn timespec_now() -> libc::timespec { let mut now = MaybeUninit::::uninit();