Skip to content

Commit 3572bea

Browse files
committed
Add dequeuing ready queue path in _sched_block()
Previously, _sched_block() only enqueued the task into the wait queue and set its state to TASK_BLOCKED. In the new scheduler design (ready-queue–based), a blocked task must also be removed from its priority's ready queue to prevent it from being selected by the scheduler. This change adds the missing dequeue path for the corresponding ready queue, ensuring behavior consistency.
1 parent 0b002a8 commit 3572bea

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/task.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,8 @@ void _sched_block(queue_t *wait_q)
10501050

10511051
tcb_t *self = kcb->task_current->data;
10521052

1053+
sched_dequeue_task(self);
1054+
10531055
if (queue_enqueue(wait_q, self) != 0)
10541056
panic(ERR_SEM_OPERATION);
10551057

0 commit comments

Comments
 (0)