aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
authorMatthew D Fleming <mdf@FreeBSD.org>2011-05-13 05:27:58 +0000
committerMatthew D Fleming <mdf@FreeBSD.org>2011-05-13 05:27:58 +0000
commit3d08a76bbc15511d93dec139ce42ceb6a4746ba1 (patch)
treeadb29eb7ec0b83c1b5131762d1a0bd2a78471e17 /sys/kern/kern_synch.c
parentc4f9a105902e0e309eee2320ef637c3fbc114694 (diff)
downloadsrc-3d08a76bbc15511d93dec139ce42ceb6a4746ba1.tar.gz
src-3d08a76bbc15511d93dec139ce42ceb6a4746ba1.zip
Use a name instead of a magic number for kern_yield(9) when the priority
should not change. Fetch the td_user_pri under the thread lock. This is probably not necessary but a magic number also seems preferable to knowing the implementation details here. Requested by: Jason Behmer < jason DOT behmer AT isilon DOT com >
Notes
Notes: svn path=/head/; revision=221829
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r--sys/kern/kern_synch.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index a3e920d043f2..d3aef7648d55 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -551,7 +551,7 @@ maybe_yield(void)
{
if (should_yield())
- kern_yield(curthread->td_user_pri);
+ kern_yield(PRI_USER);
}
void
@@ -562,6 +562,8 @@ kern_yield(int prio)
td = curthread;
DROP_GIANT();
thread_lock(td);
+ if (prio == PRI_USER)
+ prio = td->td_user_pri;
if (prio >= 0)
sched_prio(td, prio);
mi_switch(SW_VOL | SWT_RELINQUISH, NULL);