c11/threads: Use PTHREAD_MUTEX_RECURSIVE by default
authorFelix Janda <felix.janda@posteo.de>
Mon, 2 Feb 2015 19:04:16 +0000 (20:04 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 16 Mar 2015 20:41:39 +0000 (20:41 +0000)
Previously PTHREAD_MUTEX_RECURSIVE_NP had been used on linux for
compatibility with old glibc. Since mesa defines __GNU_SOURCE__
on linux PTHREAD_MUTEX_RECURSIVE is also available since at least
1998. So we can unconditionally use the portable version
PTHREAD_MUTEX_RECURSIVE.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88534
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
include/c11/threads_posix.h

index f9c165df4e0bb89305d09557a654f3ab5c107655..2182c2835aa6b39d8c1e7a3da3e04551cbe01688 100644 (file)
@@ -177,13 +177,8 @@ mtx_init(mtx_t *mtx, int type)
       && type != (mtx_try|mtx_recursive))
         return thrd_error;
     pthread_mutexattr_init(&attr);
-    if ((type & mtx_recursive) != 0) {
-#if defined(__linux__) || defined(__linux)
-        pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
-#else
+    if ((type & mtx_recursive) != 0)
         pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-#endif
-    }
     pthread_mutex_init(mtx, &attr);
     pthread_mutexattr_destroy(&attr);
     return thrd_success;