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/03/16 11:04:05 UTC
svn commit: r386301 - in /apr/apr/branches/0.9.x: CHANGES
build/apr_threads.m4 configure.in locks/unix/proc_mutex.c
Author: jorton
Date: Thu Mar 16 02:04:04 2006
New Revision: 386301
URL: http://svn.apache.org/viewcvs?rev=386301&view=rev
Log:
Merge r380120, r382030 from trunk:
* 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.
* configure.in: Use APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX instead of
just checking for pthread_mutexattr_setrobust_np.
* build/apr_threads.m4 (APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX): Add
macro.
* locks/unix/proc_mutex.c (proc_mutex_proc_pthread_create): Use
HAVE_PTHREAD_MUTEX_ROBUST instead of the heuristic test.
PR: 38442
Modified:
apr/apr/branches/0.9.x/CHANGES
apr/apr/branches/0.9.x/build/apr_threads.m4
apr/apr/branches/0.9.x/configure.in
apr/apr/branches/0.9.x/locks/unix/proc_mutex.c
Modified: apr/apr/branches/0.9.x/CHANGES
URL: http://svn.apache.org/viewcvs/apr/apr/branches/0.9.x/CHANGES?rev=386301&r1=386300&r2=386301&view=diff
==============================================================================
--- apr/apr/branches/0.9.x/CHANGES (original)
+++ apr/apr/branches/0.9.x/CHANGES Thu Mar 16 02:04:04 2006
@@ -1,5 +1,8 @@
Changes with APR 0.9.9
+ *) Prevent detection of robust mutex support with glibc 2.4,
+ fixing APR_LOCK_PROC_PTHREAD locks. PR 38442. [Joe Orton]
+
*) Fix apr_strerror() with glibc 2.4. [Joe Orton]
*) Install mkdir.sh, make_exports.awk, make_var_export.awk to the APR
Modified: apr/apr/branches/0.9.x/build/apr_threads.m4
URL: http://svn.apache.org/viewcvs/apr/apr/branches/0.9.x/build/apr_threads.m4?rev=386301&r1=386300&r2=386301&view=diff
==============================================================================
--- apr/apr/branches/0.9.x/build/apr_threads.m4 (original)
+++ apr/apr/branches/0.9.x/build/apr_threads.m4 Thu Mar 16 02:04:04 2006
@@ -227,3 +227,41 @@
[Define if recursive pthread mutexes are available])
fi
])
+
+dnl Check for robust process-shared mutex support
+AC_DEFUN([APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX], [
+AC_CACHE_CHECK([for robust cross-process mutex support],
+[apr_cv_mutex_robust_shared],
+[AC_TRY_RUN([
+#include <sys/types.h>
+#include <pthread.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ pthread_mutex_t mutex;
+ pthread_mutexattr_t attr;
+
+ if (pthread_mutexattr_init(&attr))
+ exit(1);
+ if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED))
+ exit(2);
+ if (pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP))
+ exit(3);
+ if (pthread_mutexattr_setprotocol(&mattr, PTHREAD_PRIO_INHERIT))
+ exit(4);
+ if (pthread_mutex_init(&mutex, &attr))
+ exit(5);
+ if (pthread_mutexattr_destroy(&attr))
+ exit(6);
+ if (pthread_mutex_destroy(&mutex))
+ exit(7);
+
+ exit(0);
+}], [apr_cv_mutex_robust_shared=yes], [apr_cv_mutex_robust_shared=no])])
+
+if test "$apr_cv_mutex_robust_shared" = "yes"; then
+ AC_DEFINE([HAVE_PTHREAD_MUTEX_ROBUST], 1,
+ [Define if cross-process robust mutexes are available])
+fi
+])
Modified: apr/apr/branches/0.9.x/configure.in
URL: http://svn.apache.org/viewcvs/apr/apr/branches/0.9.x/configure.in?rev=386301&r1=386300&r2=386301&view=diff
==============================================================================
--- apr/apr/branches/0.9.x/configure.in (original)
+++ apr/apr/branches/0.9.x/configure.in Thu Mar 16 02:04:04 2006
@@ -1508,24 +1508,7 @@
ac_cv_func_pthread_mutexattr_setpshared=$apr_cv_process_shared_works])
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
+ APR_CHECK_PTHREAD_ROBUST_SHARED_MUTEX
fi
fi
Modified: apr/apr/branches/0.9.x/locks/unix/proc_mutex.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/0.9.x/locks/unix/proc_mutex.c?rev=386301&r1=386300&r2=386301&view=diff
==============================================================================
--- apr/apr/branches/0.9.x/locks/unix/proc_mutex.c (original)
+++ apr/apr/branches/0.9.x/locks/unix/proc_mutex.c Thu Mar 16 02:04:04 2006
@@ -329,7 +329,7 @@
return rv;
}
-#ifdef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP
+#ifdef HAVE_PTHREAD_MUTEX_ROBUST
if ((rv = pthread_mutexattr_setrobust_np(&mattr,
PTHREAD_MUTEX_ROBUST_NP))) {
#ifdef PTHREAD_SETS_ERRNO
@@ -345,7 +345,7 @@
proc_mutex_proc_pthread_cleanup(new_mutex);
return rv;
}
-#endif
+#endif /* HAVE_PTHREAD_MUTEX_ROBUST */
if ((rv = pthread_mutex_init(new_mutex->pthread_interproc, &mattr))) {
#ifdef PTHREAD_SETS_ERRNO
@@ -379,7 +379,7 @@
#ifdef PTHREAD_SETS_ERRNO
rv = errno;
#endif
-#ifdef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP
+#ifdef HAVE_PTHREAD_MUTEX_ROBUST
/* Okay, our owner died. Let's try to make it consistent again. */
if (rv == EOWNERDEAD) {
pthread_mutex_consistent_np(mutex->pthread_interproc);