Commit b00f4b3
committed
Integrate enqueue/dequeue logic into task control APIs
This commit integrates the refactored ready-queue enqueue and
dequeue logic into all task state transition APIs, completing the
scheduler behavior for runnable <-> non-runnable transitions.
APIs with dequeue logic added:
- _sched_block(): TASK_RUNNING -> TASK_BLOCKED
- mo_task_delay(): TASK_RUNNING -> TASK_BLOCKED
- mo_task_cancel(): dequeue if the task is currently in the
ready queue; the ready-queue node is now released inside the
same critical section as the dequeue to avoid race conditions
where a dequeued task would never return and its node would
never be freed.
- mo_task_suspend(): dequeue if the task is currently runnable
APIs with enqueue logic added:
- sched_wakeup_task(): enqueue the task when it becomes runnable
- mo_task_resume(): enqueue the task when transitioning from
suspended to runnable
These updates ensure the task control APIs properly drive ready-
queue updates and maintain correct scheduler semantics across all
state transitions.1 parent 6a8d8aa commit b00f4b3
1 file changed
+28
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
| 437 | + | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
443 | | - | |
| 443 | + | |
444 | 444 | | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
| 445 | + | |
| 446 | + | |
451 | 447 | | |
452 | 448 | | |
453 | 449 | | |
| |||
721 | 717 | | |
722 | 718 | | |
723 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
724 | 726 | | |
725 | 727 | | |
726 | 728 | | |
| |||
751 | 753 | | |
752 | 754 | | |
753 | 755 | | |
754 | | - | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
755 | 760 | | |
756 | 761 | | |
757 | 762 | | |
| |||
778 | 783 | | |
779 | 784 | | |
780 | 785 | | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
781 | 793 | | |
782 | | - | |
| 794 | + | |
783 | 795 | | |
784 | 796 | | |
785 | 797 | | |
| |||
806 | 818 | | |
807 | 819 | | |
808 | 820 | | |
809 | | - | |
810 | | - | |
811 | | - | |
| 821 | + | |
| 822 | + | |
812 | 823 | | |
813 | 824 | | |
814 | 825 | | |
| |||
922 | 933 | | |
923 | 934 | | |
924 | 935 | | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
925 | 940 | | |
926 | 941 | | |
927 | 942 | | |
| |||
0 commit comments