summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_4bsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/sched_4bsd.c')
-rw-r--r--sys/kern/sched_4bsd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 834788c..0232e09 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -799,12 +799,16 @@ sched_unlend_user_prio(struct thread *td, u_char prio)
}
void
-sched_sleep(struct thread *td)
+sched_sleep(struct thread *td, int pri)
{
THREAD_LOCK_ASSERT(td, MA_OWNED);
td->td_slptick = ticks;
td->td_sched->ts_slptime = 0;
+ if (pri)
+ sched_prio(td, pri);
+ if (TD_IS_SUSPENDED(td) || pri <= PSOCK)
+ td->td_flags |= TDF_CANSWAP;
}
void
@@ -922,6 +926,7 @@ sched_wakeup(struct thread *td)
THREAD_LOCK_ASSERT(td, MA_OWNED);
ts = td->td_sched;
+ td->td_flags &= ~TDF_CANSWAP;
if (ts->ts_slptime > 1) {
updatepri(td);
resetpriority(td);
OpenPOWER on IntegriCloud