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

   ## Summary
   
   If choose CONFIG_PTHREAD_MUTEX_ROBUST flags missing _PTHREAD_MFLAGS_ROBUST 
will make tls info did not add self.
   Cause ostest break, hang on robust test.
   
   The pthread_mutex_add & pthread_mutex_remove always check the 
_PTHREAD_MFLAGS_ROBUST flag. and we miss the flag when choose 
CONFIG_PTHREAD_MUTEX_ROBUST.
   ```C
   static inline_function
   void pthread_mutex_add(FAR struct pthread_mutex_s *mutex)
   {
     FAR struct tls_info_s *tls;
   
     if ((mutex->flags & _PTHREAD_MFLAGS_ROBUST) != 0)
       {
         tls = tls_get_info();
         DEBUGASSERT(mutex->flink == NULL);
   
         /* Add the mutex to the list of mutexes held by this pthread */
   
         mutex->flink = tls->tl_mhead;
         tls->tl_mhead = mutex;
       }
   }
   ```
   
   
   ## Impact
   Before fix the ostest hang if PTHREAD_MUTEX_ROBUST choosed.
   After fix will correct pass the ostest.
   
   ## Testing
   ci-test, local sim/nsh.
   
   menuconfig select the CONFIG_PTHREAD_MUTEX_ROBUST, did not select both.
   
   ```bash
   # before fix
   user_main: robust test
   robust_test: Initializing mutex
   robust_test: Starting thread
   robust_waiter: Taking mutex
   robust_waiter: Exiting with mutex
   [1]    3523079 terminated  ./nuttx
   # hang and have to kill outside.
   
   # afterfix
   ostest_main: Exiting with status 0
   stdio_test: Standard I/O Check: fprintf to stderr
   nsh> 
   ```
   


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