pussuw commented on PR #6197:
URL: https://github.com/apache/incubator-nuttx/pull/6197#issuecomment-1118233193

   I noticed one oddity with nxtask_exit() -> nxtask_terminate() and its call 
to nxtask_exithook(). The call to nxtask_exithook() will fail every time if the 
task itself is asking to exit. The issue is that the task is removed from the 
ready-to-run list, thus any subsequent call to this_task() will return the 
wrong task's tcb.
   
   With the old implementation this was saved by how exit() was implemented on 
the kernel side, it runs nxtask_exithook() and sets a bit in the tcb which 
indicates that the exit hook has already been executed, so the second call via 
nxtask_exit() -> nxtask_terminate() -> nxtask_exithook() just returns at once.
   
   


-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to