hujun260 opened a new pull request, #18326: URL: https://github.com/apache/nuttx/pull/18326
This PR improves the semaphore interrupt wait handling by refactoring the code to reduce cyclomatic complexity and enhance maintainability. This contribution addresses code quality concerns in the semaphore subsystem by refactoring nxsem_wait_irq() to extract context restoration logic into a dedicated helper function. This change reduces cyclomatic complexity while preserving all original functionality. ### Key improvements include: 1. Extract restore_context() Helper Function: Creates a new private static inline function that encapsulates the context restoration logic including semaphore count restoration, task state cleanup, and thread scheduling operations. 2. Reduce nxsem_wait_irq() Complexity: By delegating context restoration to the helper function, the main function becomes more focused and easier to understand, improving code readability. ### TEST OSTEST -- 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]
