-
Notifications
You must be signed in to change notification settings - Fork 28
Refine current-task check in mo_task_suspend() #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
|
I defer to @HeatCrab for confirmation. |
|
LGTM! |
|
I'm curious, under what circumstances would |
Generally, there is no possibility that your inequivalent happens in the current codebase. The intention of this patch is not to fix a real bug, but to correct the semantics so that the check aligns with the meaning of the So the change is aiming to reflect the intended abstraction (task-level comparison), even though both expressions are equivalent in the current code base. If I misunderstood the intended meaning of |
|
Thanks for the clarification. Although I noticed the title starts with "Refine" instead of "Fix", the wording in the description left me a bit confused as to whether: a) In rare cases, (kcb->task_current->data == task) != (kcb->task_current == node) could actually happen. It turns out to be the latter. However, I would prefer the commit message to be more explicit that the mismatch never actually occurs, and that this change is purely for readability. |
The previous implementation compared `kcb->task_current` against the task's list node. This is always equivalent to comparing the task's TCB in the current implementation, so no functional behavior is affected and the mismatch can never occur. This change simply makes the intended semantics explicit by comparing against the TCB directly, improving readability and clarifying the abstraction.
5d27cea to
bf76c93
Compare
Thanks for the feedback. I've updated the commit message to clarify that the two conditions are always equivalent and that this change is purely for readability. |
|
Thank @vicLin8712 for contributing! |
The previous implementation compared
kcb->task_currentwith 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.
Summary by cubic
Compare the task’s TCB instead of its list node in mo_task_suspend() when checking if the target is the running task. This clarifies intent and avoids using list linkage as identity; behavior is unchanged.
Written for commit bf76c93. Summary will update automatically on new commits.