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 2003/09/13 07:05:11 UTC

cvs commit: apr/include apr_atomic.h

brianp      2003/09/12 22:05:11

  Modified:    include  apr_atomic.h
  Log:
  Faster code for apr_atomic_inc on x86
  
  Revision  Changes    Path
  1.49      +4 -5      apr/include/apr_atomic.h
  
  Index: apr_atomic.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_atomic.h,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- apr_atomic.h	3 May 2003 04:11:07 -0000	1.48
  +++ apr_atomic.h	13 Sep 2003 05:05:11 -0000	1.49
  @@ -237,11 +237,10 @@
     (--last != 0); })
   
   #define apr_atomic_inc(mem)                                     \
  -({ register apr_atomic_t last;                                  \
  -   do {                                                         \
  -       last = *(mem);                                           \
  -   } while (apr_atomic_cas((mem), last + 1, last) != last);     \
  -  })
  + asm volatile ("lock; incl %0"                                  \
  +    :                                                           \
  +    : "m" (*(mem))                                              \
  +    : "memory");
   
   #define apr_atomic_set(mem, val)     (*(mem) = val)
   #define apr_atomic_read(mem)        (*(mem))