You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by br...@apache.org on 2002/06/22 10:06:49 UTC

cvs commit: apr/include apr_atomic.h

brianp      2002/06/22 01:06:48

  Modified:    .        configure.in CHANGES
               include  apr_atomic.h
  Log:
  Optimized atomic CAS support for Linux/x86
  
  Revision  Changes    Path
  1.455     +10 -0     apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.454
  retrieving revision 1.455
  diff -u -r1.454 -r1.455
  --- configure.in	22 Jun 2002 07:28:02 -0000	1.454
  +++ configure.in	22 Jun 2002 08:06:48 -0000	1.455
  @@ -407,6 +407,16 @@
               ;;
          esac
          ;;
  +   *linux*)
  +       apr_force_atomic_generic=1
  +       case $host_cpu in
  +         i486|i586|i686)
  +            if test "$nonportable_atomics_enabled" = 1; then
  +              apr_force_atomic_generic=0
  +            fi
  +            ;;
  +       esac
  +       ;;
      *)
          OSDIR="unix"
          eolstr="\\n"
  
  
  
  1.297     +4 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.296
  retrieving revision 1.297
  diff -u -r1.296 -r1.297
  --- CHANGES	21 Jun 2002 11:33:55 -0000	1.296
  +++ CHANGES	22 Jun 2002 08:06:48 -0000	1.297
  @@ -1,5 +1,9 @@
   Changes with APR b1
   
  +  *) Added optimized atomic CAS support for Linux/x86 (available only
  +     when APR is configured with --enable-nonportable-atomics=yes)
  +     [Brian Pane]
  +
     *) Fix a compile error in the EGD support in rand.c on older Solaris
        versions.  PR 9976  [Jim Morris <jm...@sunflower.com>]
   
  
  
  
  1.29      +15 -0     apr/include/apr_atomic.h
  
  Index: apr_atomic.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_atomic.h,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- apr_atomic.h	11 Jun 2002 15:35:25 -0000	1.28
  +++ apr_atomic.h	22 Jun 2002 08:06:48 -0000	1.29
  @@ -180,6 +180,21 @@
   
   #define APR_ATOMIC_NEED_CAS_DEFAULT 1
   
  +#elif defined(__linux__) && defined(__i386__)
  +#define apr_atomic_t apr_uint32_t
  +#define apr_atomic_cas(mem,with,cmp) \
  +({ apr_atomic_t prev; \
  +    asm ("lock; cmpxchgl %1, %2"              \
  +         : "=a" (prev)               \
  +         : "r" (with), "m" (*(mem)), "0"(cmp) \
  +         : "memory"); \
  +    prev;})
  +
  +#define APR_ATOMIC_NEED_DEFAULT 1
  +#if defined(APR_ATOMIC_NEED_CAS_DEFAULT)
  +#undef APR_ATOMIC_NEED_CAS_DEFAULT
  +#endif
  +
   #elif defined(__sparc__) || defined(sparc)
   #define apr_atomic_t apr_uint32_t
   #define apr_atomic_read(p)  *p