wangchdo commented on code in PR #17222:
URL: https://github.com/apache/nuttx/pull/17222#discussion_r2454415387


##########
include/nuttx/sched.h:
##########
@@ -251,6 +251,7 @@ enum tstate_e
   TSTATE_TASK_RUNNING,        /* READY_TO_RUN - And running */
 
   TSTATE_TASK_INACTIVE,       /* BLOCKED      - Initialized but not yet 
activated */
+  TSTATE_SLEEPING,            /* BLOCKED      - Waiting for wakeup or timeout 
*/
   TSTATE_WAIT_SEM,            /* BLOCKED      - Waiting for a semaphore */
   TSTATE_WAIT_SIG,            /* BLOCKED      - Waiting for a signal */

Review Comment:
   I don't think call stack is enough in this case: the running taskB want to 
know the reason why taskA is blocked, even though this case  is hardly needed 
in real world. 
   
   Anyway I agree that users may just care whether the task is running or 
waiting, but I think kernel need to separate which object the task is waiting 
on so the kernel can do things differently according to this, please check the 
code below, I think this is the main reason nuttx now have different wait state 
: 
**TSTATE_WAIT_SEM/TSTATE_WAIT_SIG/TSTATE_WAIT_MQNOTEMPTY/TSTATE_WAIT_MQNOTFULL**:
   
   BTW: I have planed to update the code below for the new task state: 
**TSTATE_SLEEPING** 
   
   <img width="1073" height="881" alt="image" 
src="https://github.com/user-attachments/assets/7287536e-0e6d-4178-aeaf-1d3b52c56f2e";
 />
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to