mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-28 20:03:22 +00:00
Optimize the latency of lat-sig-install
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
cf9c71119a
commit
fb718fd440
@ -55,7 +55,7 @@ impl Thread {
|
||||
/// # Panics
|
||||
///
|
||||
/// This method panics if the task is not a thread.
|
||||
pub fn borrow_from_task(task: &Arc<Task>) -> &Arc<Self> {
|
||||
pub fn borrow_from_task(task: &Task) -> &Arc<Self> {
|
||||
task.data().downcast_ref::<Arc<Thread>>().unwrap()
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ use ostd::{
|
||||
use super::Thread;
|
||||
use crate::{
|
||||
cpu::LinuxAbi,
|
||||
get_current_userspace,
|
||||
prelude::*,
|
||||
process::{posix_thread::PosixThreadExt, signal::handle_pending_signal},
|
||||
syscall::handle_syscall,
|
||||
@ -46,7 +47,7 @@ pub fn create_new_user_task(user_space: Arc<UserSpace>, thread_ref: Arc<Thread>)
|
||||
// Make sure the store operation completes before the clone call returns control to user space
|
||||
// in the child process.
|
||||
if is_userspace_vaddr(child_tid_ptr) {
|
||||
CurrentUserSpace::get()
|
||||
get_current_userspace!()
|
||||
.write_val(child_tid_ptr, ¤t_posix_thread.tid())
|
||||
.unwrap();
|
||||
}
|
||||
@ -73,12 +74,12 @@ pub fn create_new_user_task(user_space: Arc<UserSpace>, thread_ref: Arc<Thread>)
|
||||
if current_thread.status().is_exited() {
|
||||
break;
|
||||
}
|
||||
handle_pending_signal(user_ctx, ¤t_thread).unwrap();
|
||||
handle_pending_signal(user_ctx, &ctx).unwrap();
|
||||
// If current is suspended, wait for a signal to wake up self
|
||||
while current_thread.status().is_stopped() {
|
||||
Thread::yield_now();
|
||||
debug!("{} is suspended.", current_posix_thread.tid());
|
||||
handle_pending_signal(user_ctx, ¤t_thread).unwrap();
|
||||
handle_pending_signal(user_ctx, &ctx).unwrap();
|
||||
}
|
||||
if current_thread.status().is_exited() {
|
||||
debug!("exit due to signal");
|
||||
|
Reference in New Issue
Block a user