diff --git a/src/header/signal/mod.rs b/src/header/signal/mod.rs index 0af7d22f53d4b9025da832084c2683c868a92335..5e06fae058990666eb8df2a9838044500710e5b2 100644 --- a/src/header/signal/mod.rs +++ b/src/header/signal/mod.rs @@ -10,6 +10,7 @@ use crate::{ time::timespec, }, platform::{self, types::*, Pal, PalSignal, Sys}, + pthread, }; pub use self::sys::*; @@ -74,6 +75,17 @@ pub extern "C" fn killpg(pgrp: pid_t, sig: c_int) -> c_int { Sys::killpg(pgrp, sig) } +#[no_mangle] +pub unsafe extern "C" fn pthread_kill(thread: pthread_t, sig: c_int) -> c_int { + let os_tid = { + let pthread = &*(thread as *const pthread::Pthread); + pthread.os_tid.get().read() + }; + crate::header::pthread::e( + Sys::rlct_kill(os_tid, sig as usize) + ) +} + #[no_mangle] pub unsafe extern "C" fn pthread_sigmask( how: c_int, diff --git a/src/pthread/mod.rs b/src/pthread/mod.rs index 14a9aee7cf59be1deacaccc81548185115eb9b0e..56b7ec1d55cace65539a15e00f27a7c055c9dc92 100644 --- a/src/pthread/mod.rs +++ b/src/pthread/mod.rs @@ -69,7 +69,7 @@ pub struct Pthread { stack_base: *mut c_void, stack_size: usize, - os_tid: UnsafeCell<OsTid>, + pub(crate) os_tid: UnsafeCell<OsTid>, } #[derive(Clone, Copy, Debug, Default, Ord, Eq, PartialOrd, PartialEq)]