FreeBSD/sys/kern/sched_ule.c
/*
 * Return whether the current CPU has runnable tasks.  Used for in-kernel
 * cooperative idle threads.
 */
Return whether the current CPU has runnable tasks.  Used for in-kernel
cooperative idle threads.
Return whether the current CPU has runnable tasks . Used for in - kernel cooperative idle threads .
int
sched_runnable(void)
{
	struct tdq *tdq;
	int load;
	load = 1;
	tdq = TDQ_SELF();
	if ((curthread->td_flags & TDF_IDLETD) != 0) {
		if (tdq->tdq_load > 0)
			goto out;
	} else
		if (tdq->tdq_load - 1 > 0)
			goto out;
	load = 0;
out:
	return (load);
}
int sched_runnable ( void ) { struct tdq * tdq ; int load ; load = 1 ; tdq = TDQ_SELF ( ) ; if ( ( curthread -> td_flags & TDF_IDLETD ) != 0 ) { if ( tdq -> tdq_load > 0 ) goto out ; } else if ( tdq -> tdq_load - 1 > 0 ) goto out ; load = 0 ; out : return ( load ) ; }
Return whether the current CPU has runnable tasks.
Return whether the current CPU has runnable tasks .