summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-03-19 05:49:38 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-03-19 05:49:38 +0000
commit8e88e8da057497b66069752a6391f435c706b441 (patch)
tree8bb70eacef4e1a4571ae518b0ff0001588c0db1b /sys/kern/kern_synch.c
parent6564ae81018f9caddd72fe4b8f51c200cad0bd78 (diff)
downloadFreeBSD-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_synch.c')
-rw-r--r--sys/kern/kern_synch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 3c0d5fa..0c479c7 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -501,8 +501,9 @@ mi_switch(void)
PCPU_SET(switchtime, new_switchtime);
CTR3(KTR_PROC, "mi_switch: old thread %p (pid %d, %s)", td, p->p_pid,
p->p_comm);
-
sched_nest = sched_lock.mtx_recurse;
+ if (td->td_proc->p_flag & P_THREADED)
+ thread_switchout(td);
sched_switchout(td);
cpu_switch(); /* SHAZAM!!*/
OpenPOWER on IntegriCloud