1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-17 15:27:36 +00:00

Assert that the thread passed to sched_bind() and sched_unbind() is

curthread as those routines are only supported for curthread currently.

MFC after:	1 month
This commit is contained in:
John Baldwin 2010-05-21 17:15:56 +00:00
parent 07969f1d4d
commit 1d7830edd5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208391
2 changed files with 5 additions and 3 deletions

View File

@ -1462,9 +1462,8 @@ sched_bind(struct thread *td, int cpu)
{
struct td_sched *ts;
THREAD_LOCK_ASSERT(td, MA_OWNED);
KASSERT(TD_IS_RUNNING(td),
("sched_bind: cannot bind non-running thread"));
THREAD_LOCK_ASSERT(td, MA_OWNED|MA_NOTRECURSED);
KASSERT(td == curthread, ("sched_bind: can only bind curthread"));
ts = td->td_sched;
@ -1482,6 +1481,7 @@ void
sched_unbind(struct thread* td)
{
THREAD_LOCK_ASSERT(td, MA_OWNED);
KASSERT(td == curthread, ("sched_unbind: can only bind curthread"));
td->td_flags &= ~TDF_BOUND;
}

View File

@ -2427,6 +2427,7 @@ sched_bind(struct thread *td, int cpu)
struct td_sched *ts;
THREAD_LOCK_ASSERT(td, MA_OWNED|MA_NOTRECURSED);
KASSERT(td == curthread, ("sched_bind: can only bind curthread"));
ts = td->td_sched;
if (ts->ts_flags & TSF_BOUND)
sched_unbind(td);
@ -2448,6 +2449,7 @@ sched_unbind(struct thread *td)
struct td_sched *ts;
THREAD_LOCK_ASSERT(td, MA_OWNED);
KASSERT(td == curthread, ("sched_unbind: can only bind curthread"));
ts = td->td_sched;
if ((ts->ts_flags & TSF_BOUND) == 0)
return;