hujun260 commented on PR #17342: URL: https://github.com/apache/nuttx/pull/17342#issuecomment-3556040496
> As with the last PR which got merged, can you please provide an explanation of why it is not possible for rtcb to be NULL in these contexts? Please include this justification in the PR summary. > > And if it is possible through user error or memory corruption, I suggest adding `DEBUGASSERT` statements to make sure the rtcb is not NULL when debugging. > > Also, what is the reason for this change? This is a very minor optimization, primarily focused on performance.For example, in the ARM64 compilation of nxsched_gettid, there were 27 instructions before the modification and 20 instructions after the modification. We should not call these functions before nx_start; therefore, this_task will not be empty. If these functions are called (before nx_start), the correct value cannot be obtained either. We should modify the logic of the calling program, as there is no need for us to be compatible with unreasonable calling scenarios.A DEBUGASSERT can be added to help expose such issues. -- 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]
