diff options
Diffstat (limited to 'src/sys/pthread.rs')
-rw-r--r-- | src/sys/pthread.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/sys/pthread.rs b/src/sys/pthread.rs index d42e45d1..fd81f3ed 100644 --- a/src/sys/pthread.rs +++ b/src/sys/pthread.rs @@ -4,8 +4,6 @@ use crate::errno::Errno; #[cfg(not(target_os = "redox"))] use crate::Result; -#[cfg(not(target_os = "redox"))] -use crate::sys::signal::Signal; use libc::{self, pthread_t}; /// Identifies an individual thread. @@ -21,6 +19,9 @@ pub fn pthread_self() -> Pthread { unsafe { libc::pthread_self() } } +feature! { +#![feature = "signal"] + /// Send a signal to a thread (see [`pthread_kill(3)`]). /// /// If `signal` is `None`, `pthread_kill` will only preform error checking and @@ -28,7 +29,9 @@ pub fn pthread_self() -> Pthread { /// /// [`pthread_kill(3)`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_kill.html #[cfg(not(target_os = "redox"))] -pub fn pthread_kill<T: Into<Option<Signal>>>(thread: Pthread, signal: T) -> Result<()> { +pub fn pthread_kill<T>(thread: Pthread, signal: T) -> Result<()> + where T: Into<Option<crate::sys::signal::Signal>> +{ let sig = match signal.into() { Some(s) => s as libc::c_int, None => 0, @@ -36,3 +39,4 @@ pub fn pthread_kill<T: Into<Option<Signal>>>(thread: Pthread, signal: T) -> Resu let res = unsafe { libc::pthread_kill(thread, sig) }; Errno::result(res).map(drop) } +} |