Skip to content

Commit 2a01530

Browse files
committed
Add sched_switch_to_idle() helper in the scheduler
Previously, when all ready queues were empty, the scheduler would trigger a kernel panic. This condition should instead transition into the idle task rather than panic. The new sched_switch_to_idle() helper centralizes this logic, making the path to idle clearer and more readable.
1 parent 9518c6f commit 2a01530

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/task.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ uint16_t sched_select_next_task(void)
515515
/* Check out bitmap */
516516
uint32_t bitmap = kcb->harts->ready_bitmap;
517517
if (unlikely(!bitmap))
518-
panic(ERR_NO_TASKS);
518+
return sched_switch_to_idle()->id;
519519

520520
/* Find top priority ready queue */
521521
int top_prio_level = 0;

0 commit comments

Comments
 (0)