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

   ## Summary
   
   This fixes an issue where ostest robust mutex test gets stuck.
   
   I found this issue while working on another signals PR, ostest was getting 
stuck in robust mutex test:
   
   ```
   ...
   robust_test: Initializing mutex
   robust_test: Starting thread
   robust_waiter: Taking mutex
   robust_waiter: Exiting with mutex
   <stuck forever>
   ```
   In this config:
   
   ```
   # CONFIG_PTHREAD_MUTEX_TYPES is not set
   CONFIG_PTHREAD_MUTEX_ROBUST=y
   # CONFIG_PTHREAD_MUTEX_UNSAFE is not set
   # CONFIG_PTHREAD_MUTEX_BOTH is not set
   # CONFIG_PTHREAD_MUTEX_DEFAULT_PRIO_NONE is not set
   CONFIG_PTHREAD_MUTEX_DEFAULT_PRIO_INHERIT=y
   ```
   
   In CONFIG_PTHREAD_MUTEX_ROBUST mode, every NORMAL mutex is robust by 
definition, so the robust flag must be set to allow the mutex to be tracked in 
the holder's mutex list.
   
   Otherwise, pthread_mutex_add() will not record the mutex and 
pthread_mutex_inconsistent() will not be able to mark it as inconsistent or 
wake waiters when the holder thread terminates.
   
   This looks like a regression from
   
   ```
   commit 6e8ae12ef1c52e42932b5223ad41399f062bc0c6
   Author: hujun5 <[email protected]>
   Date:   Sun Aug 17 10:47:26 2025 +0800
   
       pthread: make PTHREAD_MUTEX_DEFAULT_UNSAFE default true
   ```
   
   ## Impact
   
   Fixes robust mutexes in all platforms, checked with stm32f7 and sim 
platforms.
   
   ## Testing
   
   Tested on ostest in sim and stm32f7 platforms. Attached a log from ostest 
after this fix. Before the fix, the ostest gets stuck in robust mutex test.
   
[pixhawk4_ostest_partial_signal.txt](https://github.com/user-attachments/files/28840978/pixhawk4_ostest_partial_signal.txt)
   


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