Implement pthread_kill
This commit is contained in:
@@ -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
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user