Commit fdfd6b5
committed
Refactor task state–related operation APIs
This commit refactors all task operation APIs that are related to task
state transitions to support the new scheduler. The simplified
mo_enqueue_task() and mo_dequeue_task() routines are now invoked
directly inside these operations.
Enqueue and dequeue actions are performed only when the state
transition crosses the following groups:
{TASK_RUNNING, TASK_READY} ↔ {other states}
The sections below describe the detailed changes for each API:
- sched_wakeup_task(): Add TASK_RUNNING as part of the state-group
complement, avoid running tasks enqueue again.
- mo_task_cancel(): Cancel all tasks except TASK_RUNNING. If the task
is in TASK_READY, mo_dequeue_task() is invoked before cancellation.
- mo_task_delay(): Transition from TASK_RUNNING to TASK_BLOCKED;
call mo_dequeue_task() accordingly.
- mo_task_suspend(): This API can be called for both TASK_RUNNING and
TASK_READY tasks. Both conditions require invoking mo_dequeue_task()
before transitioning to TASK_SUSPEND.
- mo_task_resume(): Transition from TASK_SUSPEND to TASK_READY;
call mo_enqueue_task().
- _sched_block(): Invoked only when a TASK_RUNNING task calls mutex-
related APIs; performs the TASK_RUNNING → TASK_BLOCKED transition.1 parent 94da1c9 commit fdfd6b5
1 file changed
+21
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
431 | | - | |
| 431 | + | |
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
445 | 440 | | |
446 | 441 | | |
447 | 442 | | |
| |||
721 | 716 | | |
722 | 717 | | |
723 | 718 | | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
724 | 723 | | |
725 | 724 | | |
726 | 725 | | |
| |||
750 | 749 | | |
751 | 750 | | |
752 | 751 | | |
753 | | - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
754 | 755 | | |
755 | 756 | | |
756 | 757 | | |
| |||
777 | 778 | | |
778 | 779 | | |
779 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
780 | 786 | | |
781 | 787 | | |
782 | 788 | | |
| |||
805 | 811 | | |
806 | 812 | | |
807 | 813 | | |
808 | | - | |
809 | | - | |
810 | | - | |
| 814 | + | |
| 815 | + | |
811 | 816 | | |
812 | 817 | | |
813 | 818 | | |
| |||
921 | 926 | | |
922 | 927 | | |
923 | 928 | | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
924 | 932 | | |
925 | 933 | | |
926 | 934 | | |
| |||
0 commit comments