uC-OS3 icon indicating copy to clipboard operation
uC-OS3 copied to clipboard

A bug in the OS_FlagTaskRdy function (os_flag.c)

Open ghost opened this issue 2 years ago • 1 comments

There is missing one case, as shown in bold below: void OS_FlagTaskRdy (OS_TCB p_tcb, OS_FLAGS flags_rdy, CPU_TS ts) { #if (OS_CFG_TS_EN == 0u) (void)ts; / Prevent compiler warning for not using 'ts' */ #endif

p_tcb->FlagsRdy = flags_rdy; p_tcb->PendStatus = OS_STATUS_PEND_OK; /* Clear pend status / p_tcb->PendOn = OS_TASK_PEND_ON_NOTHING; / Indicate no longer pending / #if (OS_CFG_TS_EN > 0u) p_tcb->TS = ts; #endif switch (p_tcb->TaskState) { case OS_TASK_STATE_PEND: case OS_TASK_STATE_PEND_TIMEOUT: #if (OS_CFG_TICK_EN > 0u) if (p_tcb->TaskState == OS_TASK_STATE_PEND_TIMEOUT) { OS_TickListRemove(p_tcb); / Remove from tick list / } #endif OS_RdyListInsert(p_tcb); / Insert the task in the ready list / p_tcb->TaskState = OS_TASK_STATE_RDY; break; case OS_TASK_STATE_PEND_SUSPENDED: case OS_TASK_STATE_PEND_TIMEOUT_SUSPENDED: #if (OS_CFG_TICK_EN > 0u) if (p_tcb->TaskState == OS_TASK_STATE_PEND_TIMEOUT) { OS_TickListRemove(p_tcb); / Remove from tick list / } #endif p_tcb->TaskState = OS_TASK_STATE_SUSPENDED; break; case OS_TASK_STATE_RDY: case OS_TASK_STATE_DLY: case OS_TASK_STATE_DLY_SUSPENDED: case OS_TASK_STATE_SUSPENDED: default: / Default case. */ break; } OS_PendListRemove(p_tcb); } #endif

ghost avatar Sep 12 '21 08:09 ghost

Thank you for the report. I can confirm that this is an issue. We will add a fix in the next release.

forg0ne avatar Oct 06 '21 19:10 forg0ne