This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 36e559d6317460acd6d4d05f11b49e14d3208052
Author: hujun5 <[email protected]>
AuthorDate: Fri Nov 7 19:09:35 2025 +0800

    ticked_spinlock: Improve the performance of ticket spinlock
    
    simple spinlock time: 21 ns
    ticked spinlock time: 35 ns
    ticked spinlock time(opt): 29 ns
    
    Assisted-By: mimo-v2.6-pro
    Signed-off-by: hujun5 <[email protected]>
---
 include/nuttx/spinlock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/nuttx/spinlock.h b/include/nuttx/spinlock.h
index 7a5f79feb9a..f00d658b40a 100644
--- a/include/nuttx/spinlock.h
+++ b/include/nuttx/spinlock.h
@@ -314,7 +314,7 @@ static inline_function void
 spin_unlock_notrace(FAR volatile spinlock_t *lock)
 {
 #ifdef CONFIG_TICKET_SPINLOCK
-  atomic_add_release(&lock->owner, 1);
+  atomic_set_release(&lock->owner, lock->owner + 1);
 #else
   atomic_set_release((FAR atomic_t *)lock, SP_UNLOCKED);
 #endif

Reply via email to