You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by je...@apache.org on 2001/07/01 05:38:57 UTC

cvs commit: apr configure.in

jerenkrantz    01/06/30 20:38:57

  Modified:    .        configure.in
  Log:
  Attempt to be smarter about detection of platforms that claim to have
  pthread_mutex_t with SHARED_PROCESS support.  We now attempt to compile
  and run a test program that will validate these systems.  If this passes,
  then we can use pthread_mutex_t as a cross process locking mechanism.
  Tested on Solaris (supports SHARED_PROCESS) and Linux (does not)
  
  Revision  Changes    Path
  1.322     +26 -1     apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.321
  retrieving revision 1.322
  diff -u -r1.321 -r1.322
  --- configure.in	2001/06/28 01:57:02	1.321
  +++ configure.in	2001/07/01 03:38:56	1.322
  @@ -937,6 +937,31 @@
   if test "$threads" = "1"; then
       APR_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h)
       AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
  +    dnl Some systems have setpshared and define PROCESS_SHARED, but don't 
  +    dnl really support PROCESS_SHARED locks.  So, we must validate that we 
  +    dnl can go through the steps without receiving some sort of system error.
  +    dnl Linux and older versions of AIX have this problem.
  +    APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED func:pthread_mutexattr_setpshared, 
  +    AC_TRY_RUN([
  +        #include <sys/types.h>
  +        #include <pthread.h>
  +        int main()
  +        {
  +            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_mutex_init(&mutex, &attr))
  +                exit(3);
  +            if (pthread_mutexattr_destroy(&attr))
  +                exit(4);
  +            if (pthread_mutex_destroy(&mutex))
  +                exit(5);
  +            exit(0);
  +        }], [], [ac_cv_func_pthread_mutexattr_setpshared=no], 
  +        [ac_cv_func_pthread_mutexattr_setpshared=no]))
   fi
   
   # See which lock mechanisms we can support on this system.
  @@ -955,7 +980,7 @@
   APR_IFALLYES(header:fcntl.h define:F_SETLK,
               APR_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
   APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
  -            func:pthread_mutexattr_setpshared custom:with_pthread_cross,
  +            func:pthread_mutexattr_setpshared,
               APR_DECIDE(USE_PROC_PTHREAD_SERIALIZE, [pthread mutex]))
   if test "x$apr_lock_method" != "x"; then
       APR_DECISION_FORCE($apr_lock_method)