pthread: fix pthread_mutexattr_init()
authorEunBong Song <eunb.song@samsung.com>
Mon, 10 Apr 2017 05:55:52 +0000 (14:55 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Tue, 18 Apr 2017 03:02:13 +0000 (12:02 +0900)
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 <gnutt@nuttx.org>
[Song: backported 769427ed from NuttX]
Signed-off-by: EunBong Song <eunb.song@samsung.com>
lib/libc/pthread/pthread_mutexattrinit.c

index 2b57051..0f49c15 100644 (file)
@@ -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