FreeBSD/sys/kern/sched_ule.c
/*
 * Add a thread to a thread queue.  Select the appropriate runq and add the
 * thread to it.  This is the internal function called when the tdq is
 * predetermined.
 */
Add a thread to a thread queue.  Select the appropriate runq and add the
thread to it.  This is the internal function called when the tdq is
predetermined.
Add a thread to a thread queue . Select the appropriate runq and add the thread to it . This is the internal function called when the tdq is predetermined .
void
tdq_add(struct tdq *tdq, struct thread *td, int flags)
{
	TDQ_LOCK_ASSERT(tdq, MA_OWNED);
	KASSERT((td->td_inhibitors == 0),
	    ("sched_add: trying to run inhibited thread"));
	KASSERT((TD_CAN_RUN(td) || TD_IS_RUNNING(td)),
	    ("sched_add: bad thread state"));
	KASSERT(td->td_flags & TDF_INMEM,
	    ("sched_add: thread swapped out"));
	if (td->td_priority < tdq->tdq_lowpri)
		tdq->tdq_lowpri = td->td_priority;
	tdq_runq_add(tdq, td, flags);
	tdq_load_add(tdq, td);
}
void tdq_add ( struct tdq * tdq , struct thread * td , int flags ) { TDQ_LOCK_ASSERT ( tdq , MA_OWNED ) ; KASSERT ( ( td -> td_inhibitors == 0 ) , ( " " ) ) ; KASSERT ( ( TD_CAN_RUN ( td ) || TD_IS_RUNNING ( td ) ) , ( " " ) ) ; KASSERT ( td -> td_flags & TDF_INMEM , ( " " ) ) ; if ( td -> td_priority < tdq -> tdq_lowpri ) tdq -> tdq_lowpri = td -> td_priority ; tdq_runq_add ( tdq , td , flags ) ; tdq_load_add ( tdq , td ) ; }
Add a thread to a thread queue.
Add a thread to a thread queue .