diff options
author | julian <julian@FreeBSD.org> | 2002-09-29 23:04:34 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2002-09-29 23:04:34 +0000 |
commit | d91c37553eed3082a93a6edbef2fce6c7629aaf7 (patch) | |
tree | 511ef31f5693fdea87543a17c345986c726d9da3 /sys/kern/kern_kse.c | |
parent | 054b6a1aae2b1225e80402c333f0e68b8fafe944 (diff) | |
download | FreeBSD-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_kse.c')
-rw-r--r-- | sys/kern/kern_kse.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index ede053c..907eba7 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.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; |