hujun260 opened a new pull request, #18146:
URL: https://github.com/apache/nuttx/pull/18146

   ## Summary
   Optimize spinlock usage in boardctl by replacing direct IRQ operations with 
spinlock IRQ-safe interfaces (spin_lock_irqsave, spin_trylock_irqsave, 
spin_unlock_irqrestore) for consistency and atomic operations.
   
   ## Changes
   - Use `spin_lock_irqsave()` when both flags and lock are present
   - Use `spin_trylock_irqsave()` for try-lock operations with IRQ
   - Use `spin_unlock_irqrestore()` for unlock with IRQ restore
   - Consolidated logic: if (flags && lock) vs else if (lock)
   
   ## Impact
   - **Correctness**: Atomic IRQ-safe operations eliminate race conditions
   - **Consistency**: Follows standard NuttX spinlock interface patterns
   - **Maintainability**: Clearer code with proper semantic functions
   - **Performance**: Reduced unnecessary IRQ operations
   
   ## Testing
   - All boardctl tests pass
   - Verified IRQ state management
   - Multi-threaded concurrency validated
   - No functional regression


-- 
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