summaryrefslogtreecommitdiff
path: root/locks
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2006-02-23 14:06:15 +0000
committerJoe Orton <jorton@apache.org>2006-02-23 14:06:15 +0000
commiteeab09f47f48f06f31139d53bbb5126e4120d5db (patch)
tree478de7e93037cd1e85d5419af128df8bd3d401e6 /locks
parent1f87e289b57c978fcb370721a3866d39be696644 (diff)
downloadapr-eeab09f47f48f06f31139d53bbb5126e4120d5db.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: https://svn.apache.org/repos/asf/apr/apr/trunk@380120 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r--locks/unix/proc_mutex.c12
1 files changed, 10 insertions, 2 deletions
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