mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
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 <jukka.laitinen@tii.ae>
This commit is contained in:
parent
bb025be12d
commit
f442c6b05e
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue