Skip to content

Commit 71ba699

Browse files
committed
Fix current-task check in mo_task_suspend()
The previous implementation compared kcb->task_current directly with the task's list node, which became incorrect after introducing the embedded ready-queue list-node structure. This commit updates the condition to compare the underlying task object instead: kcb->task_current->data == task This ensures mo_task_suspend() correctly detects when the suspended task is the currently running one.
1 parent fdfd6b5 commit 71ba699

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/task.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ int32_t mo_task_suspend(uint16_t id)
784784
sched_dequeue_task(task);
785785

786786
task->state = TASK_SUSPENDED;
787-
bool is_current = (kcb->task_current == node);
787+
bool is_current = (kcb->task_current->data == task);
788788

789789
CRITICAL_LEAVE();
790790

0 commit comments

Comments
 (0)