Commit c9a07e7
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 142920e commit c9a07e7
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
856 | 856 | | |
857 | 857 | | |
858 | 858 | | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
859 | 865 | | |
860 | 866 | | |
861 | 867 | | |
862 | 868 | | |
863 | 869 | | |
864 | 870 | | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
865 | 875 | | |
866 | 876 | | |
867 | 877 | | |
| |||
0 commit comments