From: EunBong Song Date: Mon, 10 Apr 2017 05:55:52 +0000 (+0900) Subject: pthread: fix pthread_mutexattr_init() X-Git-Tag: 1.1_Public_Release~614^2~89 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f7eff1b00ae968ef89a9efa76898d29936972b89;p=rtos%2Ftinyara.git 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 --- 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