From f7eff1b00ae968ef89a9efa76898d29936972b89 Mon Sep 17 00:00:00 2001 From: EunBong Song Date: Mon, 10 Apr 2017 14:55:52 +0900 Subject: [PATCH] pthread: fix pthread_mutexattr_init() It was not initialzing the protocol field when priority inheritance is enabled. All credits should go to Gregory Nutt who wrote the original commit. Change-Id: Ib50bf1c0e4d21d306492c50d944dc6a03e5e2bc7 Signed-off-by: Gregory Nutt [Song: backported 769427ed from NuttX] Signed-off-by: EunBong Song --- lib/libc/pthread/pthread_mutexattrinit.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/libc/pthread/pthread_mutexattrinit.c b/lib/libc/pthread/pthread_mutexattrinit.c index 2b57051..0f49c15 100644 --- a/lib/libc/pthread/pthread_mutexattrinit.c +++ b/lib/libc/pthread/pthread_mutexattrinit.c @@ -110,6 +110,11 @@ int pthread_mutexattr_init(FAR pthread_mutexattr_t *attr) ret = EINVAL; } else { attr->pshared = 0; + +#ifdef CONFIG_PRIORITY_INHERITANCE + attr->proto = SEM_PRIO_INHERIT; +#endif + #ifdef CONFIG_MUTEX_TYPES attr->type = PTHREAD_MUTEX_DEFAULT; #endif -- 2.7.4