Skip to content

Commit

Permalink
Add Apple visionOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinPerez committed Apr 10, 2024
1 parent 7ab94b6 commit 2d9306a
Showing 1 changed file with 5 additions and 34 deletions.
39 changes: 5 additions & 34 deletions core/src/thread_parker/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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(target_vendor = "apple")]
#[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::<libc::pthread_condattr_t>::uninit();
Expand Down Expand Up @@ -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::<libc::timeval>::uninit();
Expand All @@ -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::<libc::timespec>::uninit();
Expand Down

0 comments on commit 2d9306a

Please sign in to comment.