FreeBSD/sys/kern/sched_ule.c
/*
 * Move a thread from one thread queue to another.
 */
Move a thread from one thread queue to another.
Move a thread from one thread queue to another .
static int
tdq_move(struct tdq *from, struct tdq *to)
{
	struct td_sched *ts;
	struct thread *td;
	struct tdq *tdq;
	int cpu;
	TDQ_LOCK_ASSERT(from, MA_OWNED);
	TDQ_LOCK_ASSERT(to, MA_OWNED);
	tdq = from;
	cpu = TDQ_ID(to);
	td = tdq_steal(tdq, cpu);
	if (td == NULL)
		return (0);
	ts = td_get_sched(td);
	thread_lock(td);
	TDQ_UNLOCK(from);
	sched_rem(td);
	ts->ts_cpu = cpu;
	td->td_lock = TDQ_LOCKPTR(to);
	tdq_add(to, td, SRQ_YIELDING);
	return (1);
}
static int tdq_move ( struct tdq * from , struct tdq * to ) { struct td_sched * ts ; struct thread * td ; struct tdq * tdq ; int cpu ; TDQ_LOCK_ASSERT ( from , MA_OWNED ) ; TDQ_LOCK_ASSERT ( to , MA_OWNED ) ; tdq = from ; cpu = TDQ_ID ( to ) ; td = tdq_steal ( tdq , cpu ) ; if ( td == NULL ) return ( 0 ) ; ts = td_get_sched ( td ) ; thread_lock ( td ) ; TDQ_UNLOCK ( from ) ; sched_rem ( td ) ; ts -> ts_cpu = cpu ; td -> td_lock = TDQ_LOCKPTR ( to ) ; tdq_add ( to , td , SRQ_YIELDING ) ; return ( 1 ) ; }
Move a thread from one thread queue to another.
Move a thread from one thread queue to another .
/*
	 * Although the run queue is locked the thread may be blocked.  Lock
	 * it to clear this and acquire the run-queue lock.
	 */ /* Drop recursive lock on from acquired via thread_lock(). */