From d0cb97cf8b6c872a1c7f47b7b295ab604e1f9184 Mon Sep 17 00:00:00 2001 From: Doug Date: Wed, 4 Jan 2023 17:56:57 +0000 Subject: [PATCH] Add support for watchOS. Mirrors macOS and iOS. --- core/src/thread_parker/unix.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/thread_parker/unix.rs b/core/src/thread_parker/unix.rs index 88b6df83..7f286037 100644 --- a/core/src/thread_parker/unix.rs +++ b/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::::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::::uninit();