Commit 3b83317
committed
Refactor mo_task_spawn() for the new scheduler
This commit refactors mo_task_spawn() to better align with the new O(1)
scheduler design. The task control block (tcb_t) now embeds its list node
directly, removing the need for an external allocation and simplifying the
ready-queue bookkeeping. The enqueue operation is also moved inside a
critical section to guarantee consistent state updates during task creation.
In addition, the previous “first task assignment” logic is removed. The
first created task is always the system idle task during startup, so this
special-case handling is no longer required.
These changes improve system consistency and allow task priority migration
to occur even before a newly created task runs for the first time.1 parent 1958450 commit 3b83317
1 file changed
+5
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
747 | 747 | | |
748 | 748 | | |
749 | 749 | | |
750 | | - | |
751 | | - | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
752 | 755 | | |
753 | 756 | | |
754 | 757 | | |
| |||
762 | 765 | | |
763 | 766 | | |
764 | 767 | | |
765 | | - | |
766 | 768 | | |
767 | 769 | | |
768 | 770 | | |
| |||
0 commit comments