implement housekeeping for posix timers
This commit is contained in:
@@ -60,7 +60,6 @@ pub(crate) struct timer_internal_t {
|
||||
pub eventfd: usize,
|
||||
pub evp: sigevent,
|
||||
pub thread: platform::types::pthread_t,
|
||||
pub caller_thread: crate::pthread::OsTid,
|
||||
/// relibc handles it_interval, not the kernel
|
||||
pub next_wake_time: itimerspec,
|
||||
/// kernel does not support unregistering timer
|
||||
@@ -72,8 +71,8 @@ pub(crate) struct timer_internal_t {
|
||||
|
||||
#[cfg(target_os = "redox")]
|
||||
impl timer_internal_t {
|
||||
pub unsafe fn from_raw(timerid: timer_t) -> &'static Mutex<Self> {
|
||||
unsafe { &*(timerid as *const Mutex<Self>) }
|
||||
pub unsafe fn from_raw(timerid: timer_t) -> &'static mut Self {
|
||||
unsafe { &mut *(timerid as *mut Self) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#[cfg(target_os = "redox")]
|
||||
use crate::header::time::timer_internal_t;
|
||||
use crate::{
|
||||
header::{
|
||||
bits_timespec::timespec,
|
||||
@@ -80,15 +78,6 @@ pub fn alarm_timespec(duration: timespec) -> c_uint {
|
||||
return remaining;
|
||||
}
|
||||
|
||||
// Enable process-wide signal delivery instead of thread-specific
|
||||
#[cfg(target_os = "redox")]
|
||||
{
|
||||
let timer_ptr = unsafe { timer_internal_t::from_raw(timer_id) };
|
||||
let mut timer_st = timer_ptr.lock();
|
||||
timer_st.process_pid = Sys::getpid();
|
||||
drop(timer_st);
|
||||
}
|
||||
|
||||
*guard = Some(AlarmTimer(timer_id));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user