summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r--sys/kern/kern_thread.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index ede053c..907eba7 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -466,6 +466,8 @@ thread_exit(void)
ke->ke_thread = NULL;
td->td_kse = NULL;
ke->ke_state = KES_UNQUEUED;
+ if (ke->ke_bound == td)
+ ke->ke_bound = NULL;
kse_reassign(ke);
/* Unlink this thread from its proc. and the kseg */
@@ -707,6 +709,13 @@ thread_userret(struct thread *td, struct trapframe *frame)
int unbound;
struct kse *ke;
+ if (td->td_kse->ke_bound) {
+ thread_export_context(td);
+ PROC_LOCK(td->td_proc);
+ mtx_lock_spin(&sched_lock);
+ thread_exit();
+ }
+
/* Make the thread bound from now on, but remember what it was. */
unbound = td->td_flags & TDF_UNBOUND;
td->td_flags &= ~TDF_UNBOUND;
OpenPOWER on IntegriCloud