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
The following commit(s) were added to refs/heads/master by this push:
new f442c6b05ef libs/libc/pthread/pthread_mutex: Fix robust mutex
initialization
f442c6b05ef is described below
commit f442c6b05efb6e5fc78f2e4721b1655f11b4d8db
Author: Jukka Laitinen <[email protected]>
AuthorDate: Thu Jun 11 16:29:16 2026 +0300
libs/libc/pthread/pthread_mutex: Fix robust mutex initialization
This fixes an issue where ostest robust mutex test gets stuck.
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.
Signed-off-by: Jukka Laitinen <[email protected]>
---
libs/libc/pthread/pthread_mutex_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/libc/pthread/pthread_mutex_init.c
b/libs/libc/pthread/pthread_mutex_init.c
index e9ca24b0347..9c6529ce87a 100644
--- a/libs/libc/pthread/pthread_mutex_init.c
+++ b/libs/libc/pthread/pthread_mutex_init.c
@@ -86,7 +86,7 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex,
mutex->flags = attr && attr->robust == PTHREAD_MUTEX_ROBUST ?
_PTHREAD_MFLAGS_ROBUST : 0;
# else
- mutex->flags = 0;
+ mutex->flags = _PTHREAD_MFLAGS_ROBUST;
# endif
#endif