Commit 4355ce8
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 fbfdfde commit 4355ce8
1 file changed
+21
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
| 457 | + | |
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
471 | 466 | | |
472 | 467 | | |
473 | 468 | | |
| |||
879 | 874 | | |
880 | 875 | | |
881 | 876 | | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
882 | 881 | | |
883 | 882 | | |
884 | 883 | | |
| |||
908 | 907 | | |
909 | 908 | | |
910 | 909 | | |
911 | | - | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
912 | 913 | | |
913 | 914 | | |
914 | 915 | | |
| |||
935 | 936 | | |
936 | 937 | | |
937 | 938 | | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
938 | 944 | | |
939 | 945 | | |
940 | 946 | | |
| |||
963 | 969 | | |
964 | 970 | | |
965 | 971 | | |
966 | | - | |
967 | | - | |
968 | | - | |
| 972 | + | |
| 973 | + | |
969 | 974 | | |
970 | 975 | | |
971 | 976 | | |
| |||
1087 | 1092 | | |
1088 | 1093 | | |
1089 | 1094 | | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
1090 | 1098 | | |
1091 | 1099 | | |
1092 | 1100 | | |
| |||
0 commit comments