Skip to content

Commit 5d27cea

Browse files
committed
Refine current-task check in mo_task_suspend()
The previous implementation compared `kcb->task_current` with the task’s list node in the global task list. A list node is only a linkage element, not a stable identifier for a task, so this comparison is not appropriate. This patch updates the check to compare the task's data structure (TCB), which properly represents the task identity.
1 parent 3d94a32 commit 5d27cea

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
@@ -883,7 +883,7 @@ int32_t mo_task_suspend(uint16_t id)
883883
}
884884

885885
task->state = TASK_SUSPENDED;
886-
bool is_current = (kcb->task_current == node);
886+
bool is_current = (kcb->task_current->data == task);
887887

888888
CRITICAL_LEAVE();
889889

0 commit comments

Comments
 (0)