summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_kse.c9
-rw-r--r--sys/kern/kern_thread.c9
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c
index b1e0abd..7e1982b 100644
--- a/sys/kern/kern_kse.c
+++ b/sys/kern/kern_kse.c
@@ -313,6 +313,7 @@ kse_exit(struct thread *td, struct kse_exit_args *uap)
{
struct proc *p;
struct ksegrp *kg;
+ struct kse *ke;
p = td->td_proc;
/* Only UTS can do the syscall */
@@ -327,13 +328,15 @@ kse_exit(struct thread *td, struct kse_exit_args *uap)
PROC_UNLOCK(p);
return (EDEADLK);
}
- if ((p->p_numthreads == 1) && (p->p_numksegrps == 1)) {
- /* XXXSKE what if >1 KSE? check.... */
+ ke = td->td_kse;
+ if (p->p_numthreads == 1) {
+ ke->ke_flags &= ~KEF_DOUPCALL;
+ ke->ke_mailbox = NULL;
p->p_flag &= ~P_KSES;
mtx_unlock_spin(&sched_lock);
PROC_UNLOCK(p);
} else {
- td->td_kse->ke_flags |= KEF_EXIT;
+ ke->ke_flags |= KEF_EXIT;
thread_exit();
/* NOTREACHED */
}
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index b1e0abd..7e1982b 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -313,6 +313,7 @@ kse_exit(struct thread *td, struct kse_exit_args *uap)
{
struct proc *p;
struct ksegrp *kg;
+ struct kse *ke;
p = td->td_proc;
/* Only UTS can do the syscall */
@@ -327,13 +328,15 @@ kse_exit(struct thread *td, struct kse_exit_args *uap)
PROC_UNLOCK(p);
return (EDEADLK);
}
- if ((p->p_numthreads == 1) && (p->p_numksegrps == 1)) {
- /* XXXSKE what if >1 KSE? check.... */
+ ke = td->td_kse;
+ if (p->p_numthreads == 1) {
+ ke->ke_flags &= ~KEF_DOUPCALL;
+ ke->ke_mailbox = NULL;
p->p_flag &= ~P_KSES;
mtx_unlock_spin(&sched_lock);
PROC_UNLOCK(p);
} else {
- td->td_kse->ke_flags |= KEF_EXIT;
+ ke->ke_flags |= KEF_EXIT;
thread_exit();
/* NOTREACHED */
}
OpenPOWER on IntegriCloud