Fix signal delivering bug for threaded process.
This commit is contained in:
parent
bdc321a648
commit
21e0492ab1
@ -1601,14 +1601,12 @@ thread_userret(struct thread *td, struct trapframe *frame)
|
||||
mtx_lock_spin(&sched_lock);
|
||||
td->td_flags &= ~TDF_CAN_UNBIND;
|
||||
mtx_unlock_spin(&sched_lock);
|
||||
if ((kg->kg_completed == NULL) &&
|
||||
if ((p->p_flag & PS_NEEDSIGCHK) == 0 &&
|
||||
(kg->kg_completed == NULL) &&
|
||||
(td->td_upcall->ku_flags & KUF_DOUPCALL) == 0) {
|
||||
thread_update_usr_ticks(td, 0);
|
||||
if (!(kg->kg_completed ||
|
||||
(td->td_upcall->ku_flags & KUF_DOUPCALL))) {
|
||||
td->td_mailbox = NULL;
|
||||
return (0);
|
||||
}
|
||||
td->td_mailbox = 0;
|
||||
return (0);
|
||||
}
|
||||
error = thread_export_context(td);
|
||||
if (error) {
|
||||
|
@ -1601,14 +1601,12 @@ thread_userret(struct thread *td, struct trapframe *frame)
|
||||
mtx_lock_spin(&sched_lock);
|
||||
td->td_flags &= ~TDF_CAN_UNBIND;
|
||||
mtx_unlock_spin(&sched_lock);
|
||||
if ((kg->kg_completed == NULL) &&
|
||||
if ((p->p_flag & PS_NEEDSIGCHK) == 0 &&
|
||||
(kg->kg_completed == NULL) &&
|
||||
(td->td_upcall->ku_flags & KUF_DOUPCALL) == 0) {
|
||||
thread_update_usr_ticks(td, 0);
|
||||
if (!(kg->kg_completed ||
|
||||
(td->td_upcall->ku_flags & KUF_DOUPCALL))) {
|
||||
td->td_mailbox = NULL;
|
||||
return (0);
|
||||
}
|
||||
td->td_mailbox = 0;
|
||||
return (0);
|
||||
}
|
||||
error = thread_export_context(td);
|
||||
if (error) {
|
||||
|
@ -253,8 +253,14 @@ ast(struct trapframe *framep)
|
||||
sigs++;
|
||||
}
|
||||
PROC_UNLOCK(p);
|
||||
if (p->p_flag & P_THREADED && sigs)
|
||||
thread_signal_upcall(td);
|
||||
if (p->p_flag & P_THREADED && sigs) {
|
||||
struct kse_upcall *ku = td->td_upcall;
|
||||
if ((void *)TRAPF_PC(framep) != ku->ku_func) {
|
||||
mtx_lock_spin(&sched_lock);
|
||||
ku->ku_flags |= KUF_DOUPCALL;
|
||||
mtx_unlock_spin(&sched_lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
userret(td, framep, sticks);
|
||||
|
Loading…
Reference in New Issue
Block a user