static struct sched_thd *fp_get_second_highest_prio(struct sched_thd *highest) { struct sched_thd *t; fp_rem_thd(highest); t = fp_get_highest_prio(); fp_add_start_runnable(highest); return t; }
struct sched_thd *schedule(struct sched_thd *t) { struct sched_thd *n; assert(!t || !sched_thd_member(t)); n = fp_get_highest_prio(); assert(n); if (n != t) return n; assert(t); return fp_get_second_highest_prio(n); }
static struct sched_thd *fp_get_second_highest_prio(struct sched_thd *highest) { struct sched_thd *t; fp_rem_thd(highest); t = fp_get_highest_prio(); fp_add_start_runnable(highest); /* printc("second highest thd %d\n", t->id); */ return t; }
struct sched_thd *schedule(struct sched_thd *t) { struct sched_thd *n; assert(!t || !sched_thd_member(t)); /* printc("get the highest_prio ---> "); */ n = fp_get_highest_prio(); assert(n); if (n != t) return n; assert(t); /* printc("get the 2nd highest_prio ---> "); */ return fp_get_second_highest_prio(n); }