summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thread.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2002-09-29 23:04:34 +0000
committerjulian <julian@FreeBSD.org>2002-09-29 23:04:34 +0000
commitd91c37553eed3082a93a6edbef2fce6c7629aaf7 (patch)
tree511ef31f5693fdea87543a17c345986c726d9da3 /sys/kern/kern_thread.c
parent054b6a1aae2b1225e80402c333f0e68b8fafe944 (diff)
downloadFreeBSD-src-d91c37553eed3082a93a6edbef2fce6c7629aaf7.zip
FreeBSD-src-d91c37553eed3082a93a6edbef2fce6c7629aaf7.tar.gz
Implement basic KSE loaning. This stops a hread that is blocked in BOUND mode
from stopping another thread from completing a syscall, and this allows it to release its resources etc. Probably more related commits to follow (at least one I know of) Initial concept by: julian, dillon Submitted by: davidxu
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