You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2006/02/23 15:06:16 UTC
svn commit: r380120 - in /apr/apr/trunk: configure.in locks/unix/proc_mutex.c
Author: jorton
Date: Thu Feb 23 06:06:15 2006
New Revision: 380120
URL: http://svn.apache.org/viewcvs?rev=380120&view=rev
Log:
* configure.in: Remove bogus check to test whether defining
_POSIX_THREAD_PRIO_INHERIT makes pthread_mutexattr_setrobust_np
available; the former is a POSIX feature test macro and is defined (or
not) by unistd.h, not the application.
* locks/unix/proc_mutex.c (proc_mutex_proc_pthread_create): Make
explicit the assumption that robust mutexes are only used if priority
inheritance is supported; this prevents use of robust mutexes with
glibc 2.3, which aren't supported for cross-process use.
PR: 38442
Modified:
apr/apr/trunk/configure.in
apr/apr/trunk/locks/unix/proc_mutex.c
Modified: apr/apr/trunk/configure.in
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/configure.in?rev=380120&r1=380119&r2=380120&view=diff
==============================================================================
--- apr/apr/trunk/configure.in (original)
+++ apr/apr/trunk/configure.in Thu Feb 23 06:06:15 2006
@@ -1604,23 +1604,6 @@
if test "$ac_cv_func_pthread_mutexattr_setpshared" = "yes"; then
AC_CHECK_FUNCS(pthread_mutexattr_setrobust_np)
- if test "$ac_cv_func_pthread_mutexattr_setrobust_np" = "no"; then
- AC_CACHE_CHECK([for pthread_mutexattr_setrobust_np with _POSIX_THREAD_PRIO_INHERIT],
- [apr_cv_setrobust_with_prio_inherit], [
- AC_TRY_COMPILE([#define _POSIX_THREAD_PRIO_INHERIT
-#include <sys/types.h>
-#include <pthread.h>],[
- int main()
- {
- pthread_mutexattr_t attr;
- pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP);
- return 0;
- }], [apr_cv_setrobust_with_prio_inherit=yes], [apr_cv_setrobust_with_prio_inherit=no])])
- if test "$apr_cv_setrobust_with_prio_inherit" = "yes"; then
- ac_cv_func_pthread_mutexattr_setrobust_np=yes
- APR_ADDTO(CPPFLAGS, -D_POSIX_THREAD_PRIO_INHERIT)
- fi
- fi
fi
fi
Modified: apr/apr/trunk/locks/unix/proc_mutex.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/locks/unix/proc_mutex.c?rev=380120&r1=380119&r2=380120&view=diff
==============================================================================
--- apr/apr/trunk/locks/unix/proc_mutex.c (original)
+++ apr/apr/trunk/locks/unix/proc_mutex.c Thu Feb 23 06:06:15 2006
@@ -325,7 +325,15 @@
return rv;
}
-#ifdef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP
+ /* It is strictly not necessary to only enable robust mutexes iff
+ * priority inheritance is supported, but historically this always
+ * has been the case. glibc 2.3 supports robust mutexes, but not
+ * cross-process robust mutexes, so enabling the robust mutex
+ * support like this ensures it is only used on Solaris, for now.
+ * A (more complicated) configure check would be necessary
+ * otherwise. */
+#if defined(HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP) \
+ && defined(_POSIX_THREAD_PRIO_INHERIT) && _POSIX_THREAD_PRIO_INHERIT > 0
if ((rv = pthread_mutexattr_setrobust_np(&mattr,
PTHREAD_MUTEX_ROBUST_NP))) {
#ifdef PTHREAD_SETS_ERRNO
@@ -343,7 +351,7 @@
pthread_mutexattr_destroy(&mattr);
return rv;
}
-#endif
+#endif /* HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP && _POSIX_THREAD_PRIO_INHERIT > 0 */
if ((rv = pthread_mutex_init(new_mutex->pthread_interproc, &mattr))) {
#ifdef PTHREAD_SETS_ERRNO