Commit bde4e35
committed
Add ready queue dequeue path in mo_task_suspend()
Previously, mo_task_suspend() only changed the task state to
TASK_SUSPENDED without removing the task from the ready queue.
As a result, suspended tasks could still be selected by the
scheduler, leading to incorrect task switching and inconsistent
queue states.
This change adds a dequeue operation to remove the corresponding
task node from its ready queue before marking it as suspended.
Additionally, the condition to detect the currently running task
has been updated: the scheduler now compares the TCB pointer
(kcb->task_current->data == task) instead of the list node
(kcb->task_current == node), since kcb->task_current now stores
a ready queue node rather than a global task list node.
If the suspended task is currently running, the CPU will yield
after the task is suspended to allow the scheduler to select
the next runnable task.
This ensures that suspended tasks are no longer visible to the
scheduler until they are resumed.1 parent 2957225 commit bde4e35
1 file changed
+9
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
| 390 | + | |
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| |||
778 | 778 | | |
779 | 779 | | |
780 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
781 | 788 | | |
782 | | - | |
| 789 | + | |
783 | 790 | | |
784 | 791 | | |
785 | 792 | | |
| |||
0 commit comments