Skip to content

Commit 09f45dd

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 4355ce8 commit 09f45dd

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
@@ -942,7 +942,7 @@ int32_t mo_task_suspend(uint16_t id)
942942
sched_dequeue_task(task);
943943

944944
task->state = TASK_SUSPENDED;
945-
bool is_current = (kcb->task_current == node);
945+
bool is_current = (kcb->task_current->data == task);
946946

947947
CRITICAL_LEAVE();
948948

0 commit comments

Comments
 (0)