Implement pthread_kill

This commit is contained in:
Jeremy Soller
2023-05-11 21:00:21 -06:00
parent 2941e5b36a
commit c1376d01dc
2 changed files with 13 additions and 1 deletions
+12
View File
@@ -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,
+1 -1
View File
@@ -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)]