summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2006-02-23 14:06:15 +0000
committerjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2006-02-23 14:06:15 +0000
commit6239a90e6026c4e4fd10700e7f3c1796287c7cc6 (patch)
tree478de7e93037cd1e85d5419af128df8bd3d401e6
parent74b9ddf4ccabf399540bf76b20775bf0791fe539 (diff)
downloadlibapr-6239a90e6026c4e4fd10700e7f3c1796287c7cc6.tar.gz
* 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 git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@380120 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--configure.in17
-rw-r--r--locks/unix/proc_mutex.c12
2 files changed, 10 insertions, 19 deletions
diff --git a/configure.in b/configure.in
index beeda49df..c8059db74 100644
--- a/configure.in
+++ b/configure.in
@@ -1604,23 +1604,6 @@ if test "$threads" = "1"; then
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
diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c
index 98fb2eb1e..514bebabe 100644
--- a/locks/unix/proc_mutex.c
+++ b/locks/unix/proc_mutex.c
@@ -325,7 +325,15 @@ static apr_status_t proc_mutex_proc_pthread_create(apr_proc_mutex_t *new_mutex,
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 @@ static apr_status_t proc_mutex_proc_pthread_create(apr_proc_mutex_t *new_mutex,
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