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 2004/01/26 16:44:28 UTC

cvs commit: apr/locks/unix thread_rwlock.c

jorton      2004/01/26 07:44:28

  Modified:    .        configure.in
               include/arch/unix apr_arch_thread_rwlock.h
               locks/unix thread_rwlock.c
  Log:
  * configure.in: Fix detection of pthread rwlocks to actually fail when
  pthread_rwlock_t can't be used; print and cache results of tests
  carried out; define HAVE_PTHREAD_RWLOCKS when rwlocks can be used.
  
  * locks/unix/thread_rwlock.c, include/arch/unix/apr_arch_thread_rwlock.h:
  Use new HAVE_PTHREAD_RWLOCKS define.
  
  PR: 22990
  
  Revision  Changes    Path
  1.566     +12 -12    apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.565
  retrieving revision 1.566
  diff -b -d -u -r1.565 -r1.566
  --- configure.in	15 Jan 2004 14:12:58 -0000	1.565
  +++ configure.in	26 Jan 2004 15:44:28 -0000	1.566
  @@ -516,22 +516,22 @@
               dnl Linux is silly as it has pthread_rwlock_init defined
               dnl but keeps the pthread_rwlock_t structure hidden unless 
               dnl special things are defined.
  +            AC_CACHE_CHECK([for pthread_rwlock_t], [apr_cv_type_rwlock_t],
               AC_TRY_COMPILE([#include <sys/types.h>
  -#include <pthread.h>], 
  -                [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
  -                 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
  -            if test "$ac_cv_struct_pthread_rw" = "no"; then
  -                AC_TRY_COMPILE([#define _XOPEN_SOURCE 500
  +#include <pthread.h>], [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
  +              [apr_cv_type_rwlock_t=yes],
  +              [AC_TRY_COMPILE([#define _XOPEN_SOURCE 500
   #define _BSD_SOURCE
   #define _SVID_SOURCE
   #include <sys/types.h>
  -#include <pthread.h>], 
  -                    [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
  -                    ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
  -                if test "$ac_cv_struct_pthread_rw" = "yes"; then
  -                    APR_ADDTO(CPPFLAGS, [-D_XOPEN_SOURCE=500 -D_BSD_SOURCE])
  -                    APR_ADDTO(CPPFLAGS, [-D_SVID_SOURCE])
  -                fi
  +#include <pthread.h>], [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
  +              [apr_cv_type_rwlock_t=yes-with-XOPEN_SOURCE], [apr_cv_type_rwlock_t=no])],
  +              [apr_cv_type_rwlock_t=no]))
  +            case $apr_cv_type_rwlock_t in
  +            yes*) AC_DEFINE(HAVE_PTHREAD_RWLOCKS, 1, [Define if pthread rwlocks are available]) ;;
  +            esac
  +            if test "$apr_cv_type_rwlock_t" = "yes-with-XOPEN_SOURCE"; then
  +               APR_ADDTO(CPPFLAGS, [-D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE])
               fi
           fi
       fi
  
  
  
  1.4       +1 -1      apr/include/arch/unix/apr_arch_thread_rwlock.h
  
  Index: apr_arch_thread_rwlock.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/apr_arch_thread_rwlock.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -b -d -u -r1.3 -r1.4
  --- apr_arch_thread_rwlock.h	25 Jan 2004 16:35:35 -0000	1.3
  +++ apr_arch_thread_rwlock.h	26 Jan 2004 15:44:28 -0000	1.4
  @@ -67,7 +67,7 @@
   #endif
   
   #if APR_HAS_THREADS
  -#ifdef HAVE_PTHREAD_RWLOCK_INIT
  +#ifdef HAVE_PTHREAD_RWLOCKS
   
   struct apr_thread_rwlock_t {
       apr_pool_t *pool;
  
  
  
  1.12      +4 -4      apr/locks/unix/thread_rwlock.c
  
  Index: thread_rwlock.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/thread_rwlock.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -b -d -u -r1.11 -r1.12
  --- thread_rwlock.c	4 Oct 2003 11:46:24 -0000	1.11
  +++ thread_rwlock.c	26 Jan 2004 15:44:28 -0000	1.12
  @@ -1,7 +1,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2004 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -57,7 +57,7 @@
   
   #if APR_HAS_THREADS
   
  -#ifdef HAVE_PTHREAD_RWLOCK_INIT
  +#ifdef HAVE_PTHREAD_RWLOCKS
   
   /* The rwlock must be initialized but not locked by any thread when
    * cleanup is called. */
  @@ -175,7 +175,7 @@
       return apr_pool_cleanup_run(rwlock->pool, rwlock, thread_rwlock_cleanup);
   }
   
  -#else  /* HAVE_PTHREAD_RWLOCK_INIT */
  +#else  /* HAVE_PTHREAD_RWLOCKS */
   
   APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock,
                                                      apr_pool_t *pool)
  @@ -213,7 +213,7 @@
       return APR_ENOTIMPL;
   }
   
  -#endif /* HAVE_PTHREAD_RWLOCK_INIT */
  +#endif /* HAVE_PTHREAD_RWLOCKS */
   APR_POOL_IMPLEMENT_ACCESSOR(thread_rwlock)
   
   #endif /* APR_HAS_THREADS */