xiaoxiang781216 commented on code in PR #15126: URL: https://github.com/apache/nuttx/pull/15126#discussion_r1882609849
########## sched/pthread/pthread_mutex.c: ########## @@ -92,7 +98,7 @@ static void pthread_mutex_remove(FAR struct pthread_mutex_s *mutex) FAR struct pthread_mutex_s *prev; irqstate_t flags; - flags = enter_critical_section(); + flags = spin_lock_irqsave(&g_mutex_spinlock); Review Comment: do we really need lock? is mhead list only modified by one thread(rtcb)? ########## sched/pthread/pthread_mutex.c: ########## @@ -38,6 +38,12 @@ #include "sched/sched.h" #include "pthread/pthread.h" +/**************************************************************************** + * Public Data + ****************************************************************************/ + +static spinlock_t g_mutex_spinlock = SP_UNLOCKED; Review Comment: move to tcb_s? only need when CONFIG_PTHREAD_MUTEX_UNSAFE isn't true. -- 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