diff options
author | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2006-03-16 10:04:04 +0000 |
---|---|---|
committer | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2006-03-16 10:04:04 +0000 |
commit | f9caeadb89fa65573e98180f7f04d4c26d504e7f (patch) | |
tree | 70fc854e698f1afe798e4f210a3cdaf23d6a71d8 /build | |
parent | ab590454bb64cec627b7907736410d2b200a2971 (diff) | |
download | libapr-f9caeadb89fa65573e98180f7f04d4c26d504e7f.tar.gz |
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
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x@386301 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'build')
-rw-r--r-- | build/apr_threads.m4 | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/build/apr_threads.m4 b/build/apr_threads.m4 index 80f7f2eb6..66e01da17 100644 --- a/build/apr_threads.m4 +++ b/build/apr_threads.m4 @@ -227,3 +227,41 @@ if test "$apr_cv_mutex_recursive" = "yes"; then [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 +]) |