diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-03-19 05:49:38 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-03-19 05:49:38 +0000 |
commit | 8e88e8da057497b66069752a6391f435c706b441 (patch) | |
tree | 8bb70eacef4e1a4571ae518b0ff0001588c0db1b /sys/kern/kern_switch.c | |
parent | 6564ae81018f9caddd72fe4b8f51c200cad0bd78 (diff) | |
download | FreeBSD-src-8e88e8da057497b66069752a6391f435c706b441.zip FreeBSD-src-8e88e8da057497b66069752a6391f435c706b441.tar.gz |
Adjust code for userland preemptive. Userland can set a quantum in
kse_mailbox to schedule an upcall, this is useful for userland timeout
routine, for example pthread_cond_timedwait().
Also extract upcall scheduling code from kse_reassign and create
a new function called thread_switchout to include these code.
Reviewed by: julain
Diffstat (limited to 'sys/kern/kern_switch.c')
-rw-r--r-- | sys/kern/kern_switch.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 1cd69bf..8c39243 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -168,40 +168,14 @@ kse_reassign(struct kse *ke) struct ksegrp *kg; struct thread *td; struct thread *original; - struct kse_upcall *ku; mtx_assert(&sched_lock, MA_OWNED); original = ke->ke_thread; KASSERT(original == NULL || TD_IS_INHIBITED(original), ("reassigning KSE with runnable thread")); kg = ke->ke_ksegrp; - if (original) { - /* - * If the outgoing thread is in threaded group and has never - * scheduled an upcall, decide whether this is a short - * or long term event and thus whether or not to schedule - * an upcall. - * If it is a short term event, just suspend it in - * a way that takes its KSE with it. - * Select the events for which we want to schedule upcalls. - * For now it's just sleep. - * XXXKSE eventually almost any inhibition could do. - */ - if (TD_CAN_UNBIND(original) && (original->td_standin) && - TD_ON_SLEEPQ(original)) { - /* - * Release ownership of upcall, and schedule an upcall - * thread, this new upcall thread becomes the owner of - * the upcall structure. - */ - ku = original->td_upcall; - ku->ku_owner = NULL; - original->td_upcall = NULL; - original->td_flags &= ~TDF_CAN_UNBIND; - thread_schedule_upcall(original, ku); - } + if (original) original->td_kse = NULL; - } /* * Find the first unassigned thread |