Skip to content

Commit ffd8c66

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 eeeeea8 commit ffd8c66

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
@@ -931,6 +931,8 @@ void _sched_block(queue_t *wait_q)
931931

932932
tcb_t *self = kcb->task_current->data;
933933

934+
sched_dequeue_task(self);
935+
934936
if (queue_enqueue(wait_q, self) != 0)
935937
panic(ERR_SEM_OPERATION);
936938

0 commit comments

Comments
 (0)