mirror of
https://github.com/drasko/codezero.git
synced 2026-02-28 17:53:13 +01:00
Removed another goto from scheduler.
This commit is contained in:
@@ -411,24 +411,26 @@ void schedule()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Determine the next task to be run */
|
/* Determine the next task to be run */
|
||||||
get_runnable_task:
|
do {
|
||||||
if (scheduler.rq_runnable->total > 0) {
|
if (scheduler.rq_runnable->total > 0) {
|
||||||
next = link_to_struct(scheduler.rq_runnable->task_list.next,
|
next = link_to_struct(scheduler.rq_runnable->task_list.next,
|
||||||
struct ktcb, rq_list);
|
|
||||||
} else {
|
|
||||||
if (scheduler.rq_expired->total > 0) {
|
|
||||||
sched_rq_swap_runqueues();
|
|
||||||
next = link_to_struct(
|
|
||||||
scheduler.rq_runnable->task_list.next,
|
|
||||||
struct ktcb, rq_list);
|
struct ktcb, rq_list);
|
||||||
} else {
|
} else {
|
||||||
/* If process, poll forever for new tasks */
|
if (scheduler.rq_expired->total > 0) {
|
||||||
if (in_process_context())
|
sched_rq_swap_runqueues();
|
||||||
goto get_runnable_task;
|
next = link_to_struct(
|
||||||
else /* If irq, resume current context */
|
scheduler.rq_runnable->task_list.next,
|
||||||
|
struct ktcb, rq_list);
|
||||||
|
} else {
|
||||||
|
/* Irq preemptions return to current task
|
||||||
|
* if no runnable tasks are available */
|
||||||
next = current;
|
next = current;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
/* If process context, poll forever for new tasks */
|
||||||
|
} while (scheduler.rq_runnable->total == 0 &&
|
||||||
|
scheduler.rq_expired->total == 0 &&
|
||||||
|
in_process_context());
|
||||||
|
|
||||||
/* New tasks affect runqueue total priority. */
|
/* New tasks affect runqueue total priority. */
|
||||||
if (next->flags & TASK_RESUMING)
|
if (next->flags & TASK_RESUMING)
|
||||||
|
|||||||
Reference in New Issue
Block a user