Commit 0da3eb0
committed
Use mo_task_migration() in mo_task_priority()
This change refactors the priority update process in mo_task_priority()
to include early-return checks and proper task migration handling.
- Early-return conditions:
* Prevent modification of the idle task.
* Disallow assigning TASK_PRIO_IDLE to non-idle tasks.
The idle task is created by idle_task_init() during system startup and
must retain its fixed priority.
- Task migration:
If the priority-changed task resides in a ready queue (TASK_READY or
TASK_RUNNING), sched_migrate_task() is called to move it to the queue
corresponding to the new priority.
- Running task behavior:
When the current running task changes its own priority, it yields the
CPU so the scheduler can dispatch the next highest-priority task.1 parent 0e1a10f commit 0da3eb0
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
847 | 847 | | |
848 | 848 | | |
849 | 849 | | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
850 | 856 | | |
851 | 857 | | |
852 | 858 | | |
853 | 859 | | |
854 | 860 | | |
855 | 861 | | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
856 | 866 | | |
857 | 867 | | |
858 | 868 | | |
| |||
0 commit comments